LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache2 website not public - confused on set up (https://www.linuxquestions.org/questions/linux-server-73/apache2-website-not-public-confused-on-set-up-4175469350/)

bengalman211 07-11-2013 11:27 PM

Apache2 website not public - confused on set up
 
Hi, I have created and installed LAMP and on my apache2 webserver I have trouble with the whole virtualhost and things I need to change and also creating a static-IP and what a LAN port is and how someone would go about port forwarding on a westell A90-750060-07

Ser Olmy 07-12-2013 12:07 AM

That's actually a whole range of questions. I'll start with the IP related ones.

About getting a static IP address: First of all, you don't "create" a static IP, your ISP allocates one for you.

The idea is that you have a domain name for your site ("www.somedomain.com") and it points to an IP address on the Internet. If you're a private broadband customer, chances are your ISP has given you a dynamically allocated address. This means that if your router is rebooted, it may come back with a different address. Your previous address may then be given to another customer.

This is a problem if the domain name still points to your previous address, which it normally will. Getting a static, public IP on your router eliminates this problem, but most ISP's charge extra for this service.

(Strictly speaking, you don't need a static address if you register your domain with dyndns.org, no-ip.com or another provider of a dynamic DNS service. Instead, you install a small program on your server, and it will update the domain host record whenever your public IP address changes. It's not quite as good as having a fixed IP address, but it may suffice for a small, private web site.

About port forwarding: Since users on the Internet will be connecting to your public IP address, which technically is allocated to your router, while the web site resides on your server with another, internal IP address, you need to set up "port forwarding".

Web traffic (HTTP and HTTPS) use the TCP protocol with specific port numbers (80 and 443 to be exact), and luckily it is possible to tell the router to forward incoming traffic to these ports to a server on the inside.

I wasn't able to find specific instructions for your router, but here's a guide for the Westel A90-750015-07. Perhaps your model is similar.

One thing about forwarding ports 80 and 443: Most routers use at least one of these ports for their built-in web-based management interface, and may not permit you to forward the port unless you first change the port of the internal web server. In that case, you should look for an option to do this, and select a port in the "high" range (between 1024 and 65535).

Once this is done, you will need to specify that port number when you connect to the router's web interface. For isntance, if your router has the internal IP address 192.168.1.1 and you move the web interface to port 8000, you will need to type "http://192.168.1.1:8000" to log in to the router.

See if you can get the port forwarding to work first. You can use an external port probing service like this to see if the port is open.

bengalman211 07-12-2013 08:57 AM

Quote:

Originally Posted by Ser Olmy (Post 4988844)
That's actually a whole range of questions. I'll start with the IP related ones.

About getting a static IP address: First of all, you don't "create" a static IP, your ISP allocates one for you.

The idea is that you have a domain name for your site ("www.somedomain.com") and it points to an IP address on the Internet. If you're a private broadband customer, chances are your ISP has given you a dynamically allocated address. This means that if your router is rebooted, it may come back with a different address. Your previous address may then be given to another customer.

This is a problem if the domain name still points to your previous address, which it normally will. Getting a static, public IP on your router eliminates this problem, but most ISP's charge extra for this service.

(Strictly speaking, you don't need a static address if you register your domain with dyndns.org, no-ip.com or another provider of a dynamic DNS service. Instead, you install a small program on your server, and it will update the domain host record whenever your public IP address changes. It's not quite as good as having a fixed IP address, but it may suffice for a small, private web site.

About port forwarding: Since users on the Internet will be connecting to your public IP address, which technically is allocated to your router, while the web site resides on your server with another, internal IP address, you need to set up "port forwarding".

Web traffic (HTTP and HTTPS) use the TCP protocol with specific port numbers (80 and 443 to be exact), and luckily it is possible to tell the router to forward incoming traffic to these ports to a server on the inside.

I wasn't able to find specific instructions for your router, but here's a guide for the Westel A90-750015-07. Perhaps your model is similar.

One thing about forwarding ports 80 and 443: Most routers use at least one of these ports for their built-in web-based management interface, and may not permit you to forward the port unless you first change the port of the internal web server. In that case, you should look for an option to do this, and select a port in the "high" range (between 1024 and 65535).

Once this is done, you will need to specify that port number when you connect to the router's web interface. For isntance, if your router has the internal IP address 192.168.1.1 and you move the web interface to port 8000, you will need to type "http://192.168.1.1:8000" to log in to the router.

See if you can get the port forwarding to work first. You can use an external port probing service like this to see if the port is open.



Alright thank you so much for this I am glad there are still people willing to help.....This post explained a lot to me but I have a few questions to get it up and running......
  • What ports do I forward? 80? If not how can I tell which to use?
  • How do I set it so when people enter my domain, it is sent to my public IP and forwarded to my private.........So basically how does it know when someone type in the URL to go to my public IP(which would then get forwarded)
  • And what(most confusing part) do I have to put in apache2's VirtualHost configs and other things like the httpd.conf and the default.com in te Sites-Available section

Ser Olmy 07-12-2013 09:27 AM

Quote:

Originally Posted by bengalman211 (Post 4989084)
  • What ports do I forward? 80? If not how can I tell which to use?

You forward port 80 if your website is to use regular, unencrypted web traffic (http://www.yoursite.com). If you're going to use HTTPS (https://wwww.your-secure-site.com), port 443 needs to be forwarded.

You can theoretically use any port, but if you use ports other than 80 for HTTP or 443 for HTTPS, the users will have to enter the port number manually in their browsers (http://www.alternative-port.com:2000).

Quote:

Originally Posted by bengalman211 (Post 4989084)
  • How do I set it so when people enter my domain, it is sent to my public IP and forwarded to my private.........So basically how does it know when someone type in the URL to go to my public IP(which would then get forwarded)

DNS takes care of that. You need to register (buy) a domain name, and then create (or have the registrar create) a so-called "A record", a DNS record pointing from your server name to your public IP address.

Quote:

Originally Posted by bengalman211 (Post 4989084)
  • And what(most confusing part) do I have to put in apache2's VirtualHost configs and other things like the httpd.conf and the default.com in te Sites-Available section

Virtual hosts are nothing but instructions telling the web server "if the client asks for a web site called such-an-such, serve files from this particular directory". You can serve multiple web sites with different names with the same web server behind the same public IP address.

The exact steps to configure a VirtualHost depends on the web server. You are using Apache, which is by far the most common web server, so there's no shortage of tutorials. Here's an example of an extremely simple VirtualHost definition:
Code:

<VirtualHost *:80>
        Servername www.mysite.com
        DocumentRoot "/var/www/htdocs/www.mysite.com/"
</VirtualHost>

What it says, is: "Bind to all IP addresses (the asterisk), and use port 80. This web site is called www.mysite.com, and the html files are in the /var/www/htdocs/www.mysite.com directory."

bengalman211 07-12-2013 10:18 AM

And when I port forward it asks me which LAN IP I want to use for it...would that be my laptops internal ip or my routers internal ip

192.168.200.X (router)

192.168.200.XXX (laptop)

bengalman211 07-12-2013 10:19 AM

It also asks me for a LAN port? What would I put there?

bengalman211 07-12-2013 10:34 AM

Here is what my first port forwarding screen looks like

Ser Olmy 07-12-2013 10:37 AM

The "LAN IP" is the IP address of your webserver. If the server is running on your laptop, you enter the laptop's IP address.

The "LAN port" is the TCP port number the web server is running on. It is possible to forward a port on the router to an entirely different port number on an internal server, but in your case the port number is the same as on the router, 80.

bengalman211 07-12-2013 11:04 AM

Ok I think I did everything right....but for some reason it still won't come up when people(not on my internet) type www.mydomain.com as a URL :O


Here is what the port forward looks like

bengalman211 07-12-2013 11:07 AM

---------------nevermind


All times are GMT -5. The time now is 12:50 AM.