Control Web Panel

WebPanel => Apache => Topic started by: GuruDavid on April 24, 2015, 09:20:03 PM

Title: Apache / Vhost Listen via IP Address
Post by: GuruDavid on April 24, 2015, 09:20:03 PM
My VPS has only 1 IP, but I'd like to be able to access my domain from the main IP address as well.

Any ideas?
Title: Re: Apache / Vhost Listen via IP Address
Post by: brijendrasial on April 25, 2015, 12:00:53 AM
/usr/local/apache/conf/sharedip.conf is responsible for that. As you can see inside ServerName and DocumentRoot is defined which is responsible for IP address to open Apache page. I went ahead and changed DocumentRoot /home/USER/public_html/ and restarted Apache. Now I can access my website with IP Address.
Title: Re: Apache / Vhost Listen via IP Address
Post by: GuruDavid on April 26, 2015, 02:28:09 PM
/usr/local/apache/conf/sharedip.conf is responsible for that. As you can see inside ServerName and DocumentRoot is defined which is responsible for IP address to open Apache page. I went ahead and changed DocumentRoot /home/USER/public_html/ and restarted Apache. Now I can access my website with IP Address.

@BullTen,

Fantastic, thanks for your reply! I did already try this, as you can see here:
--
Code: [Select]
File: /usr/local/apache/conf/sharedip.conf                                                                                                                         

NameVirtualHost 192.95.31.XX:80

<VirtualHost 192.95.31.XX:80>
    ServerName 192.95.31.XX
    ServerAdmin user@domain.com
    DocumentRoot "/home/USER/public_html"
    ScriptAlias /cgi-bin/ "/home/USER/public_html/cgi-bin/
    #
    # Custom settings are loaded below this line (if any exist)
    # Include "/usr/local/apache/conf/userdata/USER/DOMAIN/*.conf

    <Directory "/home/USER/public_html">
        AllowOverride All
    </Directory>

</VirtualHost>
*NOTE* : USER, DOMAIN, and (XX) have been replaced with proper/correct information on the live version.

Code: [Select]
NA/DEDI root@192.95.31.XX 127.0.0.1 [~]# /usr/local/apache/bin/httpd -S
VirtualHost configuration:
192.95.31.XX:80        is a NameVirtualHost
         default server 192.95.31.XX (/usr/local/apache/conf/sharedip.conf:3)
         port 80 namevhost 192.95.31.XX (/usr/local/apache/conf/sharedip.conf:3)
         port 80 namevhost DOMAIN.com (/usr/local/apache/conf.d/vhosts.conf:2)
Syntax OK

Apache is reporting that everything is functioning as it should. However, when visiting the IP address, I receive an Internal Server Error, while the domain loads properly.

Code: [Select]
[GuruDavid@vpn.sg] {~}$ whatweb 192.95.31.XX
http://192.95.31.XX [500] Apache[2.2.27][mod_ssl/2.2.27], Country[CANADA][CA], Email[user@domain.com], HTTPServer[Unix][Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/1.0.1e-fips], IP[192.95.31.XX], OpenSSL[1.0.1e-fips], Title[500 Internal Server Error]
[GuruDavid@vpn.sg] {~}$ whatweb domain.com
http://domain.com [200] Apache[2.2.27][mod_ssl/2.2.27], Country[CANADA][CA], Frame, HTTPServer[Unix][Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/1.0.1e-fips], IP[192.95.31.XX], JQuery[1.11.1], MetaGenerator[WordPress 4.1.2], OpenGraphProtocol[website], OpenSSL[1.0.1e-fips], PHP[5.4.27], Script[application/ld+json,text/javascript], Title[Domain - WordPress], WordPress[4.1.2], X-Powered-By[PHP/5.4.27], x-pingback[http://domain.com/xmlrpc.php]

Any ideas?

Regards,
Title: Re: Apache / Vhost Listen via IP Address
Post by: Administrator on April 26, 2015, 02:41:09 PM
you should check error log for this issue
/usr/local/apache/logs/error_log
Title: Re: Apache / Vhost Listen via IP Address
Post by: brijendrasial on April 26, 2015, 06:47:48 PM
well I did the same and its working fine. You need to check your error_log for more info.