I am trying to setup Apache to run on port 8080 but I do not see the entries suggested how can I add them I have run sudo nano /etc/apache2/ports.conf
and this is what my file looks like http://prntscr.com/7084yh
the tutorial says Find and change the following lines to have apache running on port 8080, accessible only from the localhost:
NameVirtualHost 127.0.0.1:8080 Listen 127.0.0.1:8080
can I just add these lines to the ports.conf file ?
thanks Mike
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
The
ports.conf
file tells apache what ports to listen on for connections. The default is 80, but there are conditions for SSL if it’s enabled.You can either add port 8080 or change from 80 to 8080.
Change the line
To this line
If you use this syntax
Then it tells apache to listen to port
8080
on interface127.0.0.1
which is the localhost. That’s not what you want, because no one will be able to connect from outside. Just useListen 8080
.Now, that will only tell Apache to listen on that port. You need to also tell it what websites are accessible from that port.
All the files listed here are the available websites. Each file should reference a
<VirtualHost>
that is configured for Apache.You can control what port a virtual host will operate on, or you can use an
*
to indicate all ports.Other possible syntax is
Or
Now, the
NameVirtualHost
directive is a little ambiguous. This tells apache what ports support virtual hosts that have aServerName
. I’ve never had to declare this directive to get named virtual hosts to work. If you want to declare the directive it would be like this, and put it in yourapache2.conf
file (not theports.conf
file).After you’ve made any changes to apache’s
*.conf
files you have to restart the server.Thanks for clearing that up, maybe some of the tutorials should be updated to help us newbies out
thanks again
Mike