Home  >  Q&A  >  body text

How to configure APACHE in this case?

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?

高洛峰高洛峰2713 days ago525

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-05-16 17:00:38

    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>

    reply
    0
  • Cancelreply