Using examples from DigitalOcean, Rackspace and others, I have (repeatedly) setup a server to provide name-based Vhosts. I have several domains registered and forwarded to my current public IP address, but any attempt to access any of them via the web results in only the default host of last resort responding.
I added the server's public IP address and the domain names to another local computer OS's hosts file, and all websites appear to be functioning fine via local access.
Since this is my first stab at web hosting, I am limited in knowing what to try next. It seems that since LAN access functions OK (with the server info added to the hosts file) and from www the server is found and requests are processed, the settings are at least close to correct. I'm thinking there's a .conf file or some such that just isn't quite right. Or perhaps router port forwarding?
Any suggestions? Any code snippets I should add here to help clarify?
Update. Here is my Virtual Host .conf
file:
# domain: example.com
# public: /var/www/example.com/html
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/html
LogLevel debug ErrorLog /var/log/apache2/error-mydomainname.com.log
CustomLog /var/log/apache2/access-mydomainname.com.log combined
</VirtualHost>
.conf
file? It must be in/etc/apache2/sites-enabled/
. And yes you need to do port forwarding from your router (that has a public IP) to the server in your LAN (that has only local IP). The ports for HTTP/HTTPS are 80 and 443. Please read this answer and especially the last section (Nr.6). – pa4080 Mar 24 '18 at 12:17public: /var/www/example.com/html
<VirtualHost *:80>
ServerAdmin admin@example.com ServerName example.com ServerAlias www.example.com
DocumentRoot /var/www/example.com/html
LogLevel debug ErrorLog /var/log/apache2/error-mydomainname.com.log CustomLog /var/log/apache2/access-mydomainname.com.log combined
– SteveMc Mar 25 '18 at 12:51http://<your-router-public-ip>/
in the browser? – pa4080 Mar 25 '18 at 13:03