How to configure APACHE in this case?
高洛峰
高洛峰 2017-05-16 16:58:38
0
1
582

The apache service is installed on 192.168.1.13. There is site 1 in the root directory of apache, and there is site 2 in the site2 directory under the root directory.
There are two domain names pointing to 192.168.1.13 through the proxy, and one domain name serves as the site 2's domain name, a domain name is accessed as an attachment to site 2.
You can access site 2 through http://www.xpdent.cn/site2/in... without modifying the configuration file

<VirtualHost *:80>
    ServerName www.xpdent.cn
    ServerAlias www.xpdent.cn
    Alias / /data/www/html/site2/
    DocumentRoot /data/www/html/site2
    DirectoryIndex  index.html
</VirtualHost>
<VirtualHost *:80>
    ServerName file.xpdent.cn
    ServerAlias file.xpdent.cn
    Alias / /data/www/html/site2/
    DocumentRoot /data/www/html/site2
    DirectoryIndex  index.html
</VirtualHost>

It is found that after adding the above configuration in sites-availiable000-default.conf, the domain name www.xpdent.cn can only access the home page of site 2, and other directories and files cannot be accessed, and a 404 error is reported. http://www.xpdent.cn/ You can access the homepage http://www.xpdent.cn/index.php. It reports a 404 error and cannot access http://www.xpdent.cn/index.html. It reports a 404 error and cannot access it

How should I configure it?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
洪涛

ServerAlias ​​is another domain name. If it doesn’t exist, you don’t need to write it.
Alias ​​can be removed and DocumentRoot writes the actual path directly.

<VirtualHost *:80>
    ServerName www.xpdent.cn
    ServerAlias xpdent.cn
    DocumentRoot /data/www/html
    DirectoryIndex  index.html
</VirtualHost>
<VirtualHost *:80>
    ServerName file.xpdent.cn
    DocumentRoot /data/www/html/site2
    DirectoryIndex  index.html
</VirtualHost>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template