Using Your PC as a Web Server

When you pay for web hosting you are thrust into a system that by its very nature will restrict much of what you can do. Todays web hosting companies force arbitrary rules on their customers to make them pay extra fees when the price for them to offer this service does not increase if you use it. IRC, streaming content, torrent trackers, ssh access, pornography, hacking software, phishing pages, wikileaks mirrors, and much other means of information are consumed by corporations in their gluttonous hunger for ever greater quantities of capital and control. Decentralised control over information is the first step in the democratisation of information, the simultaneously technological and inherently political process that started with the creation of the first systems of redundant networking; the process whose very existence is threatened today if "people like us", those who have the means to defend it, remain placated by apathy. It is for this reason that I have written the following tutorial on how to subvert the attempted control over servers by hosting corporations and massive corporate server farms.

To begin with, note that this tutorial will be focused on Ubuntu, however any Ubuntu specific information that does not apply to Fedora will be followed by the same instruction for Fedora users (ie Fedora, CentOS, RHEL). Obviously, if you use neither Fedora nor Ubuntu, I can not promise you that any of this information will apply. If you are on Fedora, make sure you are logged in as root. For Ubuntu you will only need access to sudo.

Before you do anything else, if you are on Ubuntu, do this:

sudo -i

Then enter your sudo password. This will give you root access for the rest of the session. Fedora users need not worry, and can just switch to the root account the normal way.

To start with, you will want to install Apache. Apache is the actual software that will serve people who are requesting to view a page on your server. It is very powerful (and very bloated, but that is another topic) and is by far the most popular web server software in the universe. Well, it is the most popular on Earth anyways, I really cant say what software they use for servers in the Andromeda galaxy. Anyway, to install Apache just open the command line and do as instructed below:

for Ubuntu:
apt-get install apache2

for Fedora/CentOS/RHEL:
yum install httpd

*httpd is the name of the Apache deamon on Red Hat

It is annoying that Debian based systems (for example, Ubuntu) call it apache2 instead of just apache, but whatever. Also if you were wondering why Red Hat calls it httpd, the d means deamon, and http is the protocol

that the web uses to transfer data. Lets move on!

Do this if you are on Ubuntu:

gedit /etc/apache2/ports.conf

Now that you have that file open, edit the part that says
NameVirtualHost *:80
Listen 80

To say the followingCODE :

NameVirtualHost *:9001
Listen 9001

Finally, go into the file /etc/apache2/sites-enabled/000-default with gedit and change ""

to say ""
Then save the file and close out of gedit. Run the following command:

service apache2 restart

If you are on Fedora it is much easier, just do the following:
gedit /etc/httpd/httpd.conf

Change the part that says "Listen 80" to say "Listen 9001"
service httpd restart

Why port 9001 you ask? Oh, you say you didnt ask? Well I am telling you anyway: because many ISPs block incoming connections on port 80 to their customers. Port 80 may or may not be a usable port for your webserver. Go ahead and try it instead if youd like, if it works you wont need to specify a port number when you access your site later on.

Congrats! You are almost done! Well, technically you are "done" as your computer is now a webserver, but there is some more information you might like to know. For starters, go ahead and point your browser to the

following url:

Woah! Pretty neat! But you probably want some content, am I right? Do the following commands:
[code]echo "Hello, World" > /var/www/index.html

If you are on Fedora, do "service httpd restart" instead of apache2.

Now open that same url again (localhost:9001) and viola! Your own website, that can be accessed by your friends and victims via your IP address. Just point your browser to your IP with ":9001" at the end and you will reach your site. For example, the server I just set up can as of this moment be reached at (Dont bother trying to go there by the way, there is no way my IP address will still be that by the time you are reading this).

If it is not working, and there are multiple computers on your network, you probably need to implement what is called "port forwarding." When a packet (a piece of data sent through a network) gets to your IP address requesting content, it doesn't know what computer to ask for on port 80 (or 9001). All you have to do is change your router's settings. To get to your router's configuration panel, paste the IP found in the gateway column in the last line of the output of the "route -n" command (it will be something like The details vary from one router to the next, so if you are still confused google "port forwarding" + your router type.

To add pages to your site, just put them in the /var/www folder. That folder is the "root" of your website.
As you probably know the default web page that will load when people access your site is called either index.html or index.php depending on if it has PHP code in it or not. I may make another tutorial on how to
also install PHP and MySQL to make a full LAMP server depending on whether or not this article is at all popular, so if you are wanting to do more with your server, expect that coming out soon!..


hai saya farland.seseorang yg sedang memahami dan menikmati dunia blog... I'am Blogger and Javascript Programmer.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment


Post a Comment

komentar anda sangat penting utk kemajuan blog ini.trimakasih utk kunjungannya...