这是我通过做一些搜索所学到的.这些东西来自很多地方.请指出任何遗漏的东西.(我还没试过这个,只是想澄清一下我要做什么)
对于托管我需要一个静态IP.但我的ISP提供动态IP.所以我用DynDNS的(如在CUGA劝这个).我相信这将通过将我选择的域名映射到我当前(动态分配的)实际IP来解决我的动态IP问题.
接下来是设置我的Xampp服务器.为此,我需要我的计算机的本地IP,我可以使用ipconfig(或ipconfig/all获取完整的详细信息)在Windows命令提示符下(假设本地IP为192.168.1.6).现在我必须编辑位于xampp /中的httpd.conf apache/conf文件夹."ServerName"字段必须更改为192.168.1.6:80.
这应该允许使用我从DynDNS获得的主机名的任何人访问我的计算机xampp/htdocs文件夹.如果缺少部件,请填写我的信息.
现在我想更改我的客户端可以连接到我的计算机的端口以及我将使用它来托管的文件夹.
我知道我必须首先进行protforwarding然后配置apache才能使用该端口而不是80.有人可以解释我如何配置apache以使用新端口.
我希望我的客户使用我从DynDNS获得的主机名,只访问我指定的文件夹(例如:xampp/htdocs/public),而我可以使用http:// localhost / ... 访问xampp/htdocs中的任何文件. .我认为这是虚拟主机的作用.有人可以告诉我如何做到这一点.
是否有可能出现的安全问题的解决方案以及如何最大限度地减少安全问题?
谢谢.....
你知道如何将VirtualHost文件导入httpd.conf吗?例如:
start of httpd.conf:
.
.
.
Import team-virtual-host.conf
.
.
.
end of httpd.conf
start of team-virtual-host.conf:
<VirtualHost 216.154.214.172:80>
ServerName bestrds.com
blah blah blah
</Virtualhost>
Run Code Online (Sandbox Code Playgroud)
谢谢您的帮助.
我正在使用XAMPP,Apache 2.2.17.我添加了虚拟主机,但我的虚拟主机和localhost都指向同一位置.这是我在httpd-vhosts.conf中的代码
<VirtualHost www.domain.tld:80>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot "C:/xampp/htdocs/workspace/testsite"
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/xampp"
ServerAlias localhost
ServerName localhost
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
使用上面的代码,我得到了带有www.domain.tld的testsite,这很好.但是,如果我键入localhost,它也将转到testsite.如果我在测试站点之前移动,那么localhost会转到localhost,而www.domain.tld也会转到localhost.我尝试了localhost的不同设置
<VirtualHost *>
<VirtualHost localhost:80>
Run Code Online (Sandbox Code Playgroud)
并从domain.tld中删除*.domain.tld但没有任何作用.我错过了一些明显的东西吗
所以我有这个问题......
我使用WAMP并在过去设置了完美的虚拟主机,但现在我已经达到了一些我从未预料到的东西.
我想这样做:
通过http:// localhost访问C:\ wamp\www
通过http:// localhost:8080或http://something.dev访问D:\ somethingelse
我更喜欢使用正确的http://something.dev,因为工作网站是http://something.co,所以我可以将它们分开.
我已经按照指南和阅读论坛帖子,但我到目前为止所做的就是:
通过http:// localhost或http://something.dev访问C:\ wamp\www
通过http:// localhost:8080或http://something.dev:8080访问D:\ somethingelse
有人知道你会怎么做吗?这是我的VirtualHost代码:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "C:\wamp\www"
ServerName localhost
ServerAlias www.localhost.com
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:8080>
ServerAdmin webmaster@something
DocumentRoot "D:/something/www"
ServerName something.dev
ServerAlias www.something.dev
ErrorLog "logs/something-error.log"
CustomLog "logs/something-access.log" common
<directory "D:/something/www">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</directory> …Run Code Online (Sandbox Code Playgroud) 我使用apache tomcat 7在一台机器上运行很多虚拟主机,我Host在server.xml中为每个虚拟主机插入一个标签,这样我就可以集中管理它们.
但是现在,在添加了很多主机标签后,server.xml变得如此之大,我正在寻找一种方法将每个虚拟主机相关标签放在一个单独的xml文件中(与apache对httpd.conf和虚拟主机完全相同)管理).例如,我为每个主机创建一个单独的xml文件,并将它们全部放入目录并强制tomcat加载它们!
任何的想法???
我跟随了很多文章"如何在Ubuntu中创建VirtualHost".这就是我所做的
安装Apache
sudo apt-get install lamp-server^ phpmyadmin
Run Code Online (Sandbox Code Playgroud)
我创建了site1.com在/ var/www /中调用的文件夹
然后我创建了该文件 /etc/apache2/sites-available/site1.com
然后将以下代码添加到该site1.com文件中
<VirtualHost *:80>
ServerName www.site1.com
ServerAdmin mifas@site1.com
ServerAlias site1.com
DocumentRoot /var/www/site1.com
# Other directives here
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/site1.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
然后我编辑主机文件添加了以下代码行
127.0.0.1 site1.com
Run Code Online (Sandbox Code Playgroud)
编辑
我也启用了site1.comsudo a2ensite site1.com
然后我重新启动apache serivice.(即使我重新启动了电脑)
当我去site1.com时,会说The connection has timed out错误信息.但我可以浏览localhost/site1.com.自从过去两天以来我一直在努力.没有解决方案.并关注了许多文章和视频.
我的网络应用程序项目位于/ media/disk1/Projects中的文件夹中.我想使用Apache虚拟主机来为它们提供服务http://lab/.
这就是我设置虚拟主机的方式:
1.将/ etc/apache2/sites-available/default复制到/ etc/apache2/sites-available/lab
2.编辑/ etc/apache2/sites-available/lab到以下内容:
<VirtualHost *:80>
ServerAdmin tim@localhost
ServerName lab
DocumentRoot /media/disk1/Projects
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
# <Directory /var/www/>
<Directory /media/disk1/Projects>
Require all granted
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)
3.添加127.0.0.1 lab到我的/ etc/hosts:
127.0.0.1 localhost
127.0.0.1 lab
Run Code Online (Sandbox Code Playgroud)
4. http://lab只能访问500 Internal Server Error
所有子文件夹权限都设置为drwxrwxrwx但我的http://lab/phpmyadmin工作.
帮我解决 谢谢.
我在Windows 8 PC上设置了最新版本的WAMP - 我似乎无法让多个虚拟主机工作,我加载的每个本地URL都会显示WAMP主页.
谁能解释我做错了什么?
// My hosts file
127.0.0.1 localhost
127.0.0.1 client1.localhost
127.0.0.1 client2.localhost
Run Code Online (Sandbox Code Playgroud)
我的WAMP目录中有两个文件夹,'client1'和'client2'显然每个文件夹都与上面主机文件中的client1和client2相关.
// My virtual hosts file
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:\wamp\www"
</VirtualHost>
<VirtualHost *:80>
ServerName client1.localhost
DocumentRoot "C:\wamp\www\client1"
<Directory "C:\wamp\www\client1">
allow from all
order allow,deny
AllowOverride All
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>
<VirtualHost *:80>
ServerName client2.localhost
DocumentRoot "C:\wamp\www\client2"
<Directory "C:\wamp\www\client2">
allow from all
order allow,deny
AllowOverride All
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>
Run Code Online (Sandbox Code Playgroud) 裸机(基于管理程序)和主机虚拟化类型之间有什么区别?
virtualization vmware virtualhost virtual-machine cloud-bare-metal
我在ubuntu 16.04 VM上进行开发工作
当我处理许多项目时,为了让我的生活更轻松,我使用*.dev域将VirtualDocumentRoot和hosts文件从我的主文件夹中用于服务器站点:
在000-default.conf我有:
<VirtualHost *:80>
VirtualDocumentRoot /home/steve/websites/%-2/%-2/public_html
ServerAlias *.dev
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
然后在主机中我有我正在研究的各种网站:
127.0.0.1 somesite.dev
127.0.0.1 another.dev
127.0.0.1 athirdone.dev
127.0.0.1 blog.athirdone.dev
Run Code Online (Sandbox Code Playgroud)
这样,当我添加一个新项目时,我只需要在网站目录中创建正确的文件夹结构并向主机添加一行,例如,如果我想处理一个新项目somecoolproject.dev,我只需添加一个文件夹:
/home/steve/websites/somecoolproject/somecoolproject/public_html
Run Code Online (Sandbox Code Playgroud)
和主机中的一行:
127.0.0.1 somecoolproject.dev
Run Code Online (Sandbox Code Playgroud)
我很高兴去.
无论如何,我现在工作的几乎所有内容都运行在https上,并且许多项目都有代码来强制执行此操作,无论是在源代码还是htaccess等,这使得处理开发副本变得很麻烦.
我想在我的开发机器上创建一个自签名证书,理想情况是我不需要为每个项目生成一个新的证书,所以某种通配符*.dev会很棒.
但即使我确实需要为每个项目创建一个新项目,我仍然无法解决如何使用我的设置安装它 - 我找到的所有内容都假设一个固定文档和硬编码的服务器名称.
virtualhost ×10
apache ×7
ubuntu ×3
wamp ×2
xampp ×2
config ×1
dynamic-ip ×1
httpd.conf ×1
lamp ×1
php ×1
server.xml ×1
ssl ×1
tomcat ×1
vhosts ×1
vmware ×1
webserver ×1