Page 1 of 7 123 ... LastLast
Results 1 to 10 of 66

Thread: Port Forwarding to Apache Web Server

  1. #1
    Join Date
    Jan 2014
    Beans
    38

    Port Forwarding to Apache Web Server

    I have setup Ubuntu 12.04 Server and installed an Apache2 web server. I have also installed Wordpress (and setup a basic web page). I can access my web page from an internal PC (ie. via my home wireless). I have an Actiontec V1000 modem/router from Telus (my ISP). I have setup port forwarding on my router in order to allow ssh access to the server. In particular I have forwarded port 22 to the IP address of my server. This works ok (I can access via an internal PC or an external one using the modem IP address).


    i am now trying to setup port forwarding such that I can get to my web page from an external PC. As I understand that Telus blocks port 80, I have port forwarded port 8080 on my modem to the IP address of my server. I have also made the following changes/additions to my /etc/apache2/ports.conf and /etc/apache2/sites-available/default files:


    PORTS.CONF
    NameVirtualHost *:80 [this line was already here]
    Listen 80 [this line was already here]
    Listen 8080 [I added this line]


    DEFAULT
    Replaced first line of file "<VirtualHost *:80>" with "<VirtualHost *:8080>"


    I then restarted Apache2.


    Now, when I try to browse to my web page from an external PC via http://<modem IP>:8080 I receive the following message on my browser:


    NOT FOUND
    The requested URL / was not found on this server.
    Apache/2.2.22 (Ubuntu) Server at 123.4.567.891 Port 8080


    Any idea what I am missing? It seems encouraging that it is maybe finding the server? Are there maybe additional/different entries to be made in other Apache configuration files? Should I have somehow kept both VirtualHost lines in the default file?


    Any suggestions/ideas greatly appreciated. Thank you.

  2. #2
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Port Forwarding to Apache Web Server

    Put Apache back on port 80 and just mess with the port forwarding on the router to forward port 8080 to port 80 on your web server.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  3. #3
    Join Date
    Jan 2014
    Beans
    38

    Re: Port Forwarding to Apache Web Server

    Quote Originally Posted by CharlesA View Post
    Put Apache back on port 80 and just mess with the port forwarding on the router to forward port 8080 to port 80 on your web server.
    CharlesA, thank you for the suggestion. I have done as you suggest (removed all the port 8080 stuff from the default and ports.conf files). I went into my modem/router port forwarding. It is an Actiontec V1000h. I am not entirely certain that what I have done forwards the modem port 8080 to the web server port 80, but this is what I have entered:

    1. Set the LAN Port and IP Information
    Starting Port: 8080
    Ending Port: 8080
    Protocol: TCP
    LAN IP Address: <123.456.7.89> (the internal IP address of my web server)

    2. Set the Remote Port and IP Information. (Optional)
    Starting Port: 80
    Ending Port: 80
    Set Remote IP Address: 0.0.0.0 (0.0.0.0 will use any IP address)

    Originally, I didn't enter anything into the section 2 optional area. However, I have done so now. I am not sure if this is what is needed to have it use port 80 on the web server? Or does this have to do with the port of the external machine that is trying to make a connection? At any rate I still am unable to connect to my web server. Any other suggestions you may have and/or am I doing something incorrect?

    Any further advice greatly appreciated.

  4. #4
    Join Date
    Jun 2011
    Beans
    345

    Re: Port Forwarding to Apache Web Server

    I could be mistaken, but from the settings you posted it looks as though the information might be added backwards. I would assume (thought I may be wrong) that the LAN port should be set to 80 and the remote port should be set to 8080 on the modem. I think if you reserve your settings it might work better.

  5. #5
    Join Date
    Jan 2014
    Beans
    38

    Re: Port Forwarding to Apache Web Server

    Quote Originally Posted by thnewguy View Post
    I could be mistaken, but from the settings you posted it looks as though the information might be added backwards. I would assume (thought I may be wrong) that the LAN port should be set to 80 and the remote port should be set to 8080 on the modem. I think if you reserve your settings it might work better.
    I had assumed it was this way. For example I have successfully setup port forwarding for my ssh connection. In this case I have told my server to listen on 2222 for ssh and on the port forwarding I have setup section 1 to forward 2222 to the internal IP address of my server. This was necessary as port 22 is blocked by my ISP. In this case I didn't put anything into the optional section 2 setup of port forwarding. And, it works perfectly for connecting from an external.

  6. #6
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    1,471
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Port Forwarding to Apache Web Server

    It looks backwards to me also. Try this:
    Code:
    1.  Set the LAN Port and IP Information
              Starting Port: 80
              Ending Port: 80
              Protocol:         TCP
              LAN IP Address:  <123.456.7.89> (the internal IP address of my web server)
    
    2.  Set the Remote Port and IP Information. (Optional)
              Starting Port:  8080
              Ending Port:    8080
              Set Remote IP Address:  0.0.0.0 (0.0.0.0 will use any IP address)
    And for your original posting it looks as though it was actually working but didn't find anything in the base directory or didn't know to look for index.html or whatever by default. Give us the URL you use internally.

    Edit: do "/var/log/apache2/access.log" or "/var/log/apache2/error.log" reveal any useful information?
    Last edited by Doug S; February 23rd, 2014 at 11:41 PM.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  7. #7
    Join Date
    Jan 2014
    Beans
    38

    Re: Port Forwarding to Apache Web Server

    I tried reversing the entries in port forwarding as suggested, however, can't get that to work. Also, I "think" am doing the port forwarding correctly as I have done it this way to provide ssh access from outside. In particular, I port forwarded 2222 to the internal IP address of the server by making an entry in section 1 only (forwarding port 2222 to the internal IP address of the server). And, I have been successful connecting to the ssh by specifying the modem IP and the 2222 port from outside.

    you make an excellent point that I seemed to originally be able to at least recognize there was a ubuntu server from outside. At that time I had the ports.conf and default files set up as noted in my original post. In trying to get back to that situation I have put those 2 files as noted in my original post. Now when I restart apache I get the following message:

    [warn] NameVirtualHost *:80 has no VirtualHosts
    (I am not sure if I was getting this msg before - likely not)

    Regardless, having evidently returned the setup to what I noted in my original post, I am unable to get that msg that the requested URL not found on the ubuntu server (when trying to access from external).

    Also, I checked the access.log and error.log files and found nothing of particular interest.

  8. #8
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Port Forwarding to Apache Web Server

    Quote Originally Posted by jay30 View Post
    I tried reversing the entries in port forwarding as suggested, however, can't get that to work. Also, I "think" am doing the port forwarding correctly as I have done it this way to provide ssh access from outside. In particular, I port forwarded 2222 to the internal IP address of the server by making an entry in section 1 only (forwarding port 2222 to the internal IP address of the server). And, I have been successful connecting to the ssh by specifying the modem IP and the 2222 port from outside.

    you make an excellent point that I seemed to originally be able to at least recognize there was a ubuntu server from outside. At that time I had the ports.conf and default files set up as noted in my original post. In trying to get back to that situation I have put those 2 files as noted in my original post. Now when I restart apache I get the following message:

    [warn] NameVirtualHost *:80 has no VirtualHosts
    (I am not sure if I was getting this msg before - likely not)

    Regardless, having evidently returned the setup to what I noted in my original post, I am unable to get that msg that the requested URL not found on the ubuntu server (when trying to access from external).

    Also, I checked the access.log and error.log files and found nothing of particular interest.
    You have an extra NameVirtualHost somewhere. Are you still able to access it locally?
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  9. #9
    Join Date
    Jan 2014
    Beans
    38

    Re: Port Forwarding to Apache Web Server

    Thanks again for the reply. At this point I cannot access locally - receive the message:

    the requested URL was not found on server
    apache/2.2.22 (Ubuntu) Server at 123.456.7.89 port 80

    i suppose it doesn't connect locally now because of the change in first line of default file to <VirtualHost *:8080> ?

    i will look for other NameVirtualHost - where might I find them?

  10. #10
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Port Forwarding to Apache Web Server

    Please post your configuration inside code tags. (Hit # in advanced editor)
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

Page 1 of 7 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •