0

I am setting a VPS with one IP adress to serve multiple websites. The first one is running. The second only shows an Index of / listing the two folders containing files of the two websites within the default DocumentRoot /var/www/html. When I click on the site folder it gives me a shadow html version of the site (no images, no content, no links working).How can I force the second sebsite to be served from the folder already defined in the .conf file?

This is for a new Linux server, running MySQL 5, PHP 5 and Apache 2. Both websites wordpress latest version.

First website (running) firstsite.com.conf

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName firstsite.com
    ServerAlias www.firstsite.com
    DocumentRoot /var/www/html/firstsite
 <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/html/firstsite>
                AllowOverride All
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Require all granted
        </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Second website (not running) secondsite.com.conf

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName secondsite.com
    ServerAlias www.secondsite.com
    DocumentRoot /var/www/html/secondsite
 <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/html/secondsite>
                AllowOverride All
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Require all granted
        </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I expect to output the frontend of the website secondsite.com, but the actual output is:

Index of /
[ICO]   Name    Last modified   Size    Description
[DIR]   firstsite/  2019-04-28 17:00    -    
[DIR]   secondsite/ 2013-09-25 00:18    -
9
  • It sounds like you have installed Wordpress to some other folder than /var/www/html/secondsite. What is the content of test/ and example/? Are they actually present at /var/www/html/secondsite?
    – vidarlo
    Apr 28, 2019 at 18:52
  • sorry for the typping error, I have edited it: both folders firstsite and secondsite are correctly installed with wordpress. Each one of them is respectively the main folder DocumentRoot as configured in .conf Apr 28, 2019 at 18:55
  • It's basically matching default vhost then, which has /var/www/html as root. Is the config correct? No typos? Does sudo systemctl -u apache2 show any warnings?
    – vidarlo
    Apr 28, 2019 at 19:03
  • the command sudo systemctl -u apache2 gives systemctl: invalid option -- 'u' Apr 28, 2019 at 19:13
  • Sorry. sudo journalctl -u apache2
    – vidarlo
    Apr 28, 2019 at 19:23

0

You must log in to answer this question.

Browse other questions tagged .