Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Basically, I can access everything just fine using 127.0.0.1, but if I use my external IP (123.123.123.123), I get page not found.

My router is port forwarding HTTP port 80 to port 8080 on my servers internal IP address. In other words: (Application: HTTP | Start: 80 | End: 8080 | Protocol: Both | IP Address 192.168.0.101 | Enable [YES]) I know it's forwarding properly, because when I stop port forwarding, I can access my router page by using my external IP.

My virtual hosts file is:

NameVirtualHost *:80
    <VirtualHost *:80>
    DocumentRoot /opt/lampstack-5.3.16-0/apps/wordpress
    ServerName example.com
    ServerAlias www.example.com
</VirtualHost>

and my httpd.conf file is:

Listen 80
Servername localhost:80
DocumentRoot "/opt/lampstack-5.3.16-0/apache2/htdocs
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny, allow
    deny from all
</Directory>
<Directory "/opt/lampstack-5.3.16-0/apache2/htdocs">
    Options FollowSymLinks
    AllowOverride None
    Order allow, deny
    allow from all
</Directory>
share|improve this question
    
Can you access it locally, from another computer on your network? –  Tanner Sep 26 '12 at 1:23
    
If I use my other computer in my network and type in 127.0.0.1, I get page not found. BTW, I have "Filter Internet NAT Redirection" unchecked in my router settings. But it doesn't make a difference if I turn it on or off. –  piratepartypumpkin Sep 26 '12 at 1:26
    
well you would type http://192.168.0.101/ from another computer on your network, 127.0.0.1 always refers to the local machine. –  Luke Sep 26 '12 at 1:37
    
Thanks Luke, I tried it with NAT Redirection on and off and 192.168.0.101 give me a page not found both times. –  piratepartypumpkin Sep 26 '12 at 1:39
    
Have you checked to see what your apache error log is saying? Look for ErrorLog in your httpd.conf to find where it is. –  Luke Sep 26 '12 at 2:39
add comment

3 Answers

You are using name-based virtual hosting. If you try to access your web site using another name, you will get the default site.

NameVirtualHost *:80

Servername localhost:80
share|improve this answer
    
Sorry if I'm not understanding properly. What do I do to fix this? do I put "Servername 123.123.123.123:80" instead of "Servername localhost:80"? 123.123.123.123 being my external IP. Also if I try to access my website using example.com or www.example.com, it also gives me a page not found. –  piratepartypumpkin Sep 26 '12 at 1:42
    
According to apache.org, " The asterisks match all addresses, so the main server serves no requests. Due to the fact that www.example.com is first in the configuration file, it has the highest priority and can be seen as the default or primary server. That means that if a request is received that does not match one of the specified ServerName directives, it will be served by this first VirtualHost." so it should default to the first (only) vhost anyway. If it was using the default site, he would see apache2/htdocs wouldn't he? –  Luke Sep 26 '12 at 2:02
    
You're right from what I've read as well Luke, I tried www.example.com, I tried example.com, I tried example.com:80, and www.example.com:80 and no luck so far. –  piratepartypumpkin Sep 26 '12 at 2:15
add comment

I think the problem comes from specifying a DocumentRoot that has deny permissions on it - but you should be getting 403 Forbidden Errors, not 404 Not Found (at least I do when I try to mimic your config).

DocumentRoot /opt/lampstack-5.3.16-0/apps/wordpress

becuase this directory doesn't have a <Directory > entry it inherits the default permissions of

<Directory />
  Options FollowSymLinks
  AllowOverride None
  Order deny, allow
  deny from all
</Directory>

try commenting out the deny lines

  #Order deny, allow
  #deny from all

or creating a new entry, to test for this problem

<Directory "/opt/lampstack-5.3.16-0/apps/wordpress">
  Options FollowSymLinks
  AllowOverride None
  Order allow, deny
  allow from all
</Directory>

Note: you should be trying to access the server with an ip address for now, www.example.com won't get you anywhere cause there is no DNS entry for it (or if there is, it doesn't point to your server).

share|improve this answer
    
What I did was I changed Order deny,allow to Order allow,deny and I changed Deny from all to Allow from all. Then I restarted apache, the problem remains unchanged. –  piratepartypumpkin Sep 26 '12 at 2:42
    
Well if you really are getting "404 Not Found" errors, and not "403 Forbidden", I'm not sure. Are you sure you don't have a software firewall or something blocking incoming traffic on 80? You need to find your ErrorLog and access logs and see if they can provide any clues about what's happening. –  Luke Sep 26 '12 at 5:31
add comment

It looks like it was a router problem. Even though I had tried restarting my router, even though I tried everything with nat redirection enabled and disabled. I was just sitting down, and my router reset itself. I had to enter the default password to get into my router admin page (instead of the password I set). Everything worked fine after that.

Also try having nothing in your vhosts file, that can also work

Moral of the story: try a different router just in case.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.