I can't externally access my home server's wordpress website

0

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>

piratepartypumpkin

Posted 2012-09-26T01:19:25.537

Reputation: 63

Can you access it locally, from another computer on your network? – Tanner Faulkner – 2012-09-26T01:23:12.643

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 – 2012-09-26T01:26:57.807

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 – 2012-09-26T01:37:16.627

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 – 2012-09-26T01:39:00.993

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 – 2012-09-26T02:39:10.510

Answers

1

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

David Schwartz

Posted 2012-09-26T01:19:25.537

Reputation: 58 310

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 – 2012-09-26T01:42:54.860

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 – 2012-09-26T02:02:36.403

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 – 2012-09-26T02:15:55.270

1

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).

Luke

Posted 2012-09-26T01:19:25.537

Reputation: 1 025

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 – 2012-09-26T02:42:31.453

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 – 2012-09-26T05:31:23.187

1

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.

piratepartypumpkin

Posted 2012-09-26T01:19:25.537

Reputation: 63