Previously webservers was used only by enterprises and other businesses, now a days quite a few individuals have their own webserver.Apache is the favourite among the webservers.Its pretty easy to setup.Just run a few commands and you have your webserver up and running.So in this tutorial you would be able to setup successfully a webserver and can access it from anywhere in the world.Webservers can be very useful, you can setup your own website,your own wiki,you can access your files through webservers and you could do a lot of other fun stuff.
There is an awesome package called LAMP in linux. This one package includes apache,mysql and php.These are normally the basic tools to get you started with a webserver.So here's how you do it.
Step 1 : Go to System->Administration->Synaptic Package Manager->Edit->Mark Packages by Task-->
LAMP Server --> Apply .This would install the LAMP server on your pc.
Step 2 : Quite easy right, you already have your apache webserver running..If you try http://127.0.0.1 you should be able to access your own website..
Step 3 :(OPTIONAL) Now apache by default uses port 80 to connect, incase you want to change the default port to something else then go to the terminal and type sudo gedit /etc/apache2/ports.conf .The ports.conf file should open and you should see something similar to this
Listen 80
Listen 443
Now replace 80( the default port).. to whatever other port you wish.. save the file and back in the terminal type sudo /etc/init.d/apache2 restart
Step 4 :(OPTIONAL) Again apache by default uses the /var/www directory .This is the Default DocumentRoot set by apache.This is the place where you keep all your html or php scripts and pages so that they can be accessed from the web.In case you want to change the default directory from /var/www to something else, you may do so.Say for example i want to change it from /var/www to /home/prash/server ..For this go to the terminal and type sudo gedit /etc/apache2/sites-available/default
You should see a file which starts like this
NameVirtualHost *
ServerAdmin webmaster@localhost
DocumentRoot /var/www
Options FollowSymLinks
AllowOverride None
...........
Now if you notice, the third line has DocumentRoot as /var/www .. All you need to do is replace all the /var/www to the directory you wish( in this case /home/prash/server .In your text editor. Press Ctrl + H and under "Search For" type /var/www and under "Replace With" Type /home/prash/server and hit the Replace All button.Once done save the text file and close it.. and back in the terminal type sudo /etc/init.d/apache2 restart
Step 5 :The last and final step which is required for you to be able to access your desktop from the internet is to port forward.The default port to portforward is 80 but incase you have changed it in Step 3 ..Then open the port accordingly.You can Follow this guide HERE to open the port in your router.Or go HERE and find your router to port forward
NOTE:Incase you dont have a static ip and your ip changes everytime , it may be difficult to remember the ip address, so here's how you can get a free or paid domain name pointing towards your webserver.CLICK HERE to view the tutorial
This should be it and you should have your apache server up and running with php and mysql support.This is just the basic apache guide to get you started.Apache has a lot of features and mods available to use to enhance your webserver experience.Features like VirtualHost,htaccess and htpasswd for password protection etc are available.Hope you remember that incase you want any file or html page to be shown on your webserver i.e. incase you have an index.html to place as a homepage for your website.. you would have to put it in your DocumentRoot which is /var/www by default but incase you have changed it to something else(like /home/prash/server in this example) then you got to put the files there.So have fun with your Webserver!!!Take care!!
|
0
comments
]
0 comments
Post a Comment