Jump to content

Set up apache

- - - - -

  • Please log in to reply
4 replies to this topic

#1
jakash3

jakash3

    Newbie

  • Members
  • PipPip
  • 21 posts
===================================
Host your website on your Linux box
===================================

I'm actually a beginner and just learned this myself, hopefully this tutorial is
accurate enough.

First open Terminal. A common keyboard shortcut to do this on most distros is
CTRL + ALT + T.

Install apache webserver software by running this command:
sudo apt-get install apache2
Run this command:
ifconfig | grep "inet addr"
In the output, find your LAN ip address that starts with 192.168.

Enter this:
route -n | grep "UG"
In the first line of output, the address starting with 192.168 should be your
router/gateway.

Go to your browser and navigate to the address of your router.
Log in and configure a new port forwarding rule to have requests to your LAN
IP address to start on port 80 and end on port 80.

Now all you need to do is find your internet ip address (whatismyip.org)
and give it to the world so other people can see your website.

More info:

Your web directory is, by default, located in /var/www/
edit index.html and add more files to your desire.

If the port is not 80 then enter: grep "Listen" /etc/apache2/ports.conf
The first line of output will be the port.

If you forgot your router username, then google your router model
or go to Default Password List

if you forgot your router password and it's not the default password, then
reset your router by holding that small button at the bottom or on back
of it for like 30 seconds.

dyndns.org allows you to register an almost custom domain name for your
ip address for free.
Posted Image
Posted Image

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Umm... Just a note: my LAN IP address starts with 10.0.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
Depending on the version, it can be stored in many places (/srv/www is a common one.)

There should be mention of other ports, and other gateway addresses. I am unsure 192.168.0.0/16 is always the range for the router especially when you are setting Apache up through a router or network.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#4
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
Yeah, I have the 10.0.X.X range at home and at school, I wonder why- its faster to type for a start :)
How do we configure PHP?
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).

#5
debtboy

debtboy

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 916 posts
Great Post :w00t:
Part 2 should include sub-domains and virtual hosts as Apache 1.3 vs. 2.X differ greatly.
In addition there are differences between Debian/Ubuntu vs. most other Linux/*nix distros.
(sym links and individual files vs. httpd.conf for virtual servers on sub-domains). ;)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users