Install Apache and Enable mod_rewrite Ubuntu Linux
The Apache HTTP Server, commonly referred to simply as Apache IPA: /əˈpætʃi/, is a web server notable for playing a key role in the initial growth of the World Wide Web and in 2009 became the first web server to surpass the 100 million web site milestone. Apache was the first viable alternative to the Netscape Communications Corporation web server (currently known as Sun Java System Web Server), and has since evolved to rival other Unix-based web servers in terms of functionality and performance. The majority of all web servers using Apache are Linux web servers.
First install the apache2.2 php5 and mysql
sudo apt-get install apache2 php5 php5-gd mysql-server-5.0 phpmyadmin
This will install all the necessary applications. You may be prompted to decide on a MySQL root password (set one if you want), and to configure PHPMyAdmin (select apache2 as the server type). After this is complete, we need to perform some minor configuration to get PHPMyAdmin working. Type:
sudo gedit /etc/apache2/apache2.conf
Add this line at the bottom
# Enable PHPMyAdmin
Include /etc/phpmyadmin/apache.conf
Now Save and Exit then restart Apache
sudo /etc/init.d/apache2 restart
Everything should now be configured – go to http://127.0.0.1 for webpages, and http://127.0.0.1/phpmyadmin for database administration. The webroot is located in /var/www/ by default.
since you dont have access to folder /var/www as normal user you will have to fix it using this step:
Adding a virtual host to your LAMP server
This allows us to access a different folder as our webroot from a different address in our browser – face it, ‘localhost’ or 127.0.0.1
Start by adding a new host. This is easy to do via System –> Administration –> Network; click on the Hosts tab, select the localhost item from the list and click properties. You may need to click the ‘Unlock’ button and enter your password first. Underneath the entry ‘localhost’, on a new line, add your entry of choice; for example, we’ll use ‘modastig’. Add this, and close all the dialogs.
Now we need to edit a configuration file, so type into the console:
sudo gedit /etc/apache2/httpd.conf
In the resulting file (which may well be empty), add the definition for your host! My username is ‘mod’, and I want my webpages to be served from a directory named ‘www’ in my home, so I would add:
<VirtualHost *>
ServerName modastig
DocumentRoot /home/mod/www
</VirtualHost>
I can now add files to /home/mod/www, and access them by visiting http://modastig
Now enable mod_rewrite
cd /etc/apache2/mods-enabled
sudo touch rewrite.load
sudo gedit rewrite.load (you may use any editor to edit this file)
now paste this following line
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
Then edit
sudo gedit /etc/apache2/sites-available/default
Find the following
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
and change it to
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
and finally restart Apache
sudo /etc/init.d/apache2 restart
Jun 17, 2008 at 6:01 AM /
dota…
Dota is a really great game! Thanks for this post mate!…