Web development and Linux Web Server cloning

View previous topic View next topic Go down

Web development and Linux Web Server cloning

Post by jamied_uk on 9th December 2013, 20:40

The default directory for files of a site is in /var/www. To access this directory, we need rights of root. To create a website, for example, /home/user/www/ perform the following steps:
1. Make a copy of the standard config file site (/etc/apache2/sites-available/default) and rename it to (/etc/apache2/sites-available/mysite).
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
2. Open a new config file in a text editor nano.
sudo nano /etc/apache2/sites-available/mysite
3. Change the DocumentRoot setting in the new location site.
/home/user/www/
4. Change the parameter Directory, replacing on . So, you you get something like:

ServerAdmin webmaster@localhost
 
DocumentRoot /home/stleon/www

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

 
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

 
ErrorLog ${APACHE_LOG_DIR}/error.log
 
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
 
CustomLog ${APACHE_LOG_DIR}/access.log combined
 
    Alias /doc/ "/usr/share/doc/"
   
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
   

 


ServerAdmin webmaster@localhost
 
DocumentRoot /home/stleon/www

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

 
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

 
ErrorLog ${APACHE_LOG_DIR}/error.log
 
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
 
CustomLog ${APACHE_LOG_DIR}/access.log combined
 
    Alias /doc/ "/usr/share/doc/"
   
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
   

 
Save the file.
5. Now you have to deactivate the old site (default) and add a new (mysite).
sudo a2dissite default && sudo a2ensite mysite
6. Restart Apache2:
sudo /etc/init.d/apache2 restart
7. Then open with gedit /etc/apache2/envvars:
sudo gedit /etc/apache2/envvars
8. Find export APACHE_RUN_USER=www-data and export APACHE_RUN_GROUP=www-data. Replace it to 
export APACHE_RUN_USER=username export APACHE_RUN_GROUP=username
 
9. Restart Apache2:
sudo /etc/init.d/apache2 restart


If after you do this you get any errors this example will help you


I fixt it manually with:
Code:

sudo chown -R ciaobello:ciaobello /var/lock/apache2   
avatar
jamied_uk
Admin

Posts : 1990
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum