我不知道该寻找什么,但这是我想要实现的。
我在某个地方注册了域名。我在其他地方也有一个专用的Linux服务器。我在Linux服务器上运行一个网站(Apache/PHP),现在我可以通过它访问:
http://[my server ip address]/subfolder-1/index.php
我将域名的DNS设置更改为我的Linux服务器的IP地址。现在,当我转到我的域名时,它实际上加载了index.php:http://[my server ip address]。
我知道我可以在Aapache中做一些事情,这样它就可以知道用户何时来自www.mydomain.com,它应该显示位于以下位置的站点:
http://[my server ip address]/subfolder-1/index.php
当我从www.my-otherdomain.com来的时候,它应该从:
http://[my server ip address]/subfolder-2/index.php
但我不知道该找什么这叫什么?如何配置Apache服务器?
发布于 2014-12-20 16:39:21
您需要为Apache上的每个域设置虚拟主机,如下所示:
<VirtualHost *:80>
ServerAdmin admin@test.com
ServerName test.com
ServerAlias www.test.com
DocumentRoot /var/www/test.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>在重新加载服务器之后:
sudo服务apache2重新启动
https://stackoverflow.com/questions/27582151
复制相似问题