Apache2, making my site publicly available

Posted on

Apache2, making my site publicly available – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about ubuntu, apache-2.2, web-server, router, connection.

I want to make my apache 2 development server public to the internet, it is a Django based website.

Here is my apache2 config:

<VirtualHost *:80>
Alias /media /home/user/myproject/statics
Alias /admin_media  /home/myuser/django/Django-1.1.1/django/contrib/admin/media

WSGIScriptAlias / /home/myuser/myproject/myproject_wsgi.py
WSGIDaemonProcess myproject user=myuser group=myuser threads=25
WSGIProcessGroup myproject
</VirtualHost>

When I do netstat -lntup

I get:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -               
tcp6       0      0 :::80                   :::*                    LISTEN      -               
tcp6       0      0 :::22                   :::*                    LISTEN      -               
tcp6       0      0 ::1:631                 :::*                    LISTEN      -               
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           -               
udp        0      0 0.0.0.0:38582           0.0.0.0:*    

I connect with ADSL thus I am behind a router. For this I have made my computer DMZ enabled to my machine.

What can be the problem? When I try to login with my ip, I get my routers config page, when a friend tries to connect to me from internet, he gets “not authorized”.

Solution :

You need to use your router config to do port forwarding of port 80. Not all routers support port forwarding though.

Also, one IP (your public IP) can’t share a single port. Port 80 is in use by the router’s own web server (which is handling the router config interface). You may need to forward a non-standard port like 8080 from your router to your Apache server’s port 80. In that case, your friend would use http://your-public-ip:8080/

Third, ensure Apache is configured to work on port 80 over IPv4. According to your netstat output, it’s only binding to IPv6 on port 80 right now.

To test things, first you should test locally on the Apache server that http://127.0.0.1/ works. Once that is working, you can add the port forwarding for external access.

Leave a Reply

Your email address will not be published.