Securing local Apache dev environment

bc5

Honorable
Dec 5, 2012
286
0
10,810
Hello!

I've set up my first LAMP environment for PHP web work on Mint 17 with Xfce and it's working well enough, but when I do this:

$ gksudo "gedit /etc/apache2/ports.conf"

Change ports.conf so that it contains:

Listen 127.0.0.1:80

(from https://help.ubuntu.com/community/ApacheMySQLPHP#Securing_Apache)

It causes my webpage to not load:

This site can’t be reached

www.active.dev refused to connect.
Try:
Reloading the page
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED

When I "sudo apache2ctl start" I get:

(98)Address already in use: AH00072: make_sock: could not bind to address 127.0.0.1:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.

I have no idea about sockets stuff. Can anyone tell me how to correct it? I can work without doing this but I'd feel happier to know it's set up securely. Thanks in advance for any guidance.
 
Solution
When you add the

Listen 127.0.0.1:80

line do you also delete (or comment out) the

Listen 80

line? If not then I believe that you have overlapping Listen directives which will lead to the error you are getting.

McHenryB

Admirable
You are trying to access the web page from a browser on the computer that is running Apache? (Not another computer or a virtual machine.) Also, what is the IP address of www.active.dev? The way you are setting things up you should be accessing the page (on the same computer) with the address "localhost", unless you have made an entry in your hosts file or DNS server pointing www.active.dev to 127.0.0.1.
 

bc5

Honorable
Dec 5, 2012
286
0
10,810
Yeah that's right - purely for working locally. active.dev does indeed point to 127.0.0.1 via hosts file and it works fine provided that 'Listen 127.0.0.1:80' line isn't in ports.conf.
 

bc5

Honorable
Dec 5, 2012
286
0
10,810
That goes to the site, same result as 'localhost' or 'www.active.dev'. This is what's in ports.conf:

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80

<IfModule ssl_module>
Listen 443
</IfModule>

<IfModule mod_gnutls.c>
Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
 

McHenryB

Admirable
When you add the

Listen 127.0.0.1:80

line do you also delete (or comment out) the

Listen 80

line? If not then I believe that you have overlapping Listen directives which will lead to the error you are getting.
 
Solution