Tuesday, 22 January 2013

Setting up Apache on ubuntu

Installing Apache and php5

sudo apt-get install apache2 
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5

Then restart apache server

sudo /etc/init.d/apache2 restart

Now edit the httpd.conf file and set the server name. Open the file in your favorite text editor, (sublime for me)

sudo subl /etc/apache2/httpd.conf

and add the following line to set the server name

ServerName localhost

Now get started with using your server, type localhost in your browser window and you will be directed to the default page for apache server, which you can edit at /var/www/

You can also add projects to /var/www/ which you want to run on your apache server.
To add to this directory you will need root access, there are many hacks to get around this, there is direct command line command with root access, other include mendling with permissions,

sudo cp path/to/your/file /var/www/
Post a Comment