简体   繁体   中英

httpd Virtual Hosts File Redirecting to Incorrect Website

I have an EC2 server running Amazon Linux AMI.

I have a number of websites running on the server and have an httpd-vhosts.conf file setup.

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "/vol2/html-studio/www"
ServerName "studioofcrayons.com"
ErrorLog "logs/studioofcrayons.com-error_log"
CustomLog "logs/studioofcrayons.com-access_log" common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "/vol2/html-studio/www"
ServerName "www.studioofcrayons.com"
ErrorLog "logs/studioofcrayons.com-error_log"
CustomLog "logs/studioofcrayons.com-access_log" common
</VirtualHost>

This site works correctly, as do the others I have setup.

Recently though I have added

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "/vol2/html-snr/www"
ServerName "sundaynightraving.com"
ErrorLog "logs/sundaynightraving.com-error_log"
CustomLog "logs/sundaynightraving.com-access_log" common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "/vol2/html-snr/www"
ServerName "www.sundaynightraving.com"
ErrorLog "logs/sundaynightraving.com-error_log"
CustomLog "logs/sundaynightraving.com-access_log" common
</VirtualHost>

www.sundaynightraving.com works, but for some reason going to sundaynightraving.com redirects to the studioofcrayons.com website and URL instead.

I cannot see anything in the logfiles, there doesn't appear to be any errors being generated. httpd -t returns 'syntax ok' httpd -S returns

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server studioofcrayons.com (/etc/httpd/conf/httpd-vhosts.conf:1)
         port 80 namevhost studioofcrayons.com (/etc/httpd/conf/httpd-vhosts.conf:1)
         port 80 namevhost www.studioofcrayons.com (/etc/httpd/conf/httpd-vhosts.conf:9)
         port 80 namevhost sofc.uk (/etc/httpd/conf/httpd-vhosts.conf:17)
         port 80 namevhost www.sofc.uk (/etc/httpd/conf/httpd-vhosts.conf:25)
         port 80 namevhost oneillmtc.co.uk (/etc/httpd/conf/httpd-vhosts.conf:33)
         port 80 namevhost www.oneillmtc.co.uk (/etc/httpd/conf/httpd-vhosts.conf:41)
         port 80 namevhost datasaab.com (/etc/httpd/conf/httpd-vhosts.conf:49)
         port 80 namevhost www.datasaab.com (/etc/httpd/conf/httpd-vhosts.conf:57)
         port 80 namevhost sundaynightraving.com (/etc/httpd/conf/httpd-vhosts.conf:65)
         port 80 namevhost www.sundaynightraving.com (/etc/httpd/conf/httpd-vhosts.conf:73)
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/vol2"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex default: dir="/var/run/httpd/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex cache-socache: using_defaults
Mutex authdigest-opaque: using_defaults
Mutex watchdog-callback: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex lua-ivm-shm: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
PidFile: "/var/run/httpd/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48
Group: name="apache" id=48

Is there something I have missed, or something else I can check? Does anyone have any ideas?

The issue I had now appears to have resolved itself overnight.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM