Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

242
Views
Apache Virtual Hosts for Two Sites Not Working Properly

I am trying to have two separate sites with Apache virtual hosts on a test server. I am going to access the sites with the ip address of the instance (for example, http://167.275.122.215). When I enable the following configuration, I would be able to load the first site with just the ip address correctly (with http://167.275.122.215), but not http://167.275.122.215/exp. I get a 404 error when I point to that address. What am I doing wrong here?

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/main

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

</VirtualHost>

<VirtualHost *:80>
    Alias /exp /usr/share/wordpress
    DocumentRoot /usr/share/wordpress

    <Directory /usr/share/wordpress>
           Options FollowSymLinks
           AllowOverride all
           DirectoryIndex index.php
           require all granted
    </Directory>
</VirtualHost>

In fact, my need is to be able to access the exp (experimental) site through the same ip while the main site is still available (from the original ip address). I tried giving a different port to the experimental site too (like below), but that still gave me a site can't be reached error.

<VirtualHost *:90>
       <Directory /usr/share/wordpress>
           Options FollowSymLinks
           AllowOverride all
           DirectoryIndex index.php
           require all granted
       </Directory>    
</VirtualHost>
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

For port based multiple sites, listing the default port as the second site resolved the issue:

LISTEN 90

<VirtualHost *:90>
        DocumentRoot /usr/share/wordpress
       <Directory /usr/share/wordpress>
           Options FollowSymLinks
           AllowOverride all
           DirectoryIndex index.php
           require all granted
       </Directory>
</VirtualHost>

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/main

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!