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
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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
Listen 80
To this line
Listen 8080
If you use this syntax
Listen 127.0.0.1:8080
Then it tells apache to listen to port 8080 on interface 127.0.0.1 which is the localhost. That’s not what you want, because no one will be able to connect from outside. Just use Listen 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.
$ cd /etc/apache2/sites-available
$ ls
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.
<VirtualHost *>
ServerName whathappentoday.com
ServerAlias www.whathappentoday.com
DocumentRoot /var/whathappentoday/web/www
<Directory /var/whathappentoday/web/www>
Options FollowSymLinks
AllowOverride all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.whathappentoday.log
CustomLog ${APACHE_LOG_DIR}/access.whathappentoday.log combined
</VirtualHost>
Other possible syntax is
<VirtualHost 127.0.0.1:8080>
Or
<VirtualHost *:8080>
Now, the NameVirtualHost directive is a little ambiguous. This tells apache what ports support virtual hosts that have a ServerName. 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 your apache2.conf file (not the ports.conf file).
NameVirtualHost *:8080
After you’ve made any changes to apache’s *.conf files you have to restart the server.
$ service apache2 restart
Thanks for clearing that up, maybe some of the tutorials should be updated to help us newbies out
thanks again
Mike
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.