steps to website setup ( apache 2.2.8 )


A. Steps to set up a website for name1.com

create system user
now we add a ftp user
chang the permission
create the directory structure
change the permission and ownnership
edit the httpd-vhost.conf
how to rotate the logs
mod_rewrite
alias for his domain
add custom error page
deny certain IP
add certin mime type
redirect visitors to another page

B. Steps for building awstats for name1.com

see bellow


C . Steps to delete website name1.com
see bellow





Steps to set up a website for name1.com

1 create system user

useradd -d /websites/name1.com -s /sbin/nologin name1

2. now we adda ftp user

/usr/local/pureftpd/bin/pure-pw useradd name1 -f /usr/local/pureftpd/etc/pureftpd.passwd -u name1 -d /websites/name1.com -m
enterpassword
retype password

3. we chang the permission for the the user name1 ( 711 )

chmod 711 /websites/name1.com

4. we create the directory structure for the doamin name1.com

mkdir /websites/name1.com/web /websites/name1.com/logs /websites/name1.com/private /websites/name1.com/data /websites/name1.com/cgi-bin

5.we change the permission and ownnership of the directories we jsut created

chmod 711 /websites/name1.com/*
chown name1:name1 /websites/name1.com/*
6. Now we edit the httpd-vhost.conf ( /usr/local/apache2/conf/extra/httpd-vhosts.conf )
we the add the vhsot directive for name1.com

###########vhost for name1.com.com ############################
<VirtualHost 192.168.0.244:80>
ServerAdmin admin@name1.sys.qualiproj.com
ServerName name1.sys.qualiproj..com
ServerAlias www.name1.sys.qualiproj..com
DocumentRoot /websites/name1.com/web
<Directory /websites/name1.com/web>
Options -MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
AllowOverride FileInfo AuthConfig Limit
Order allow,deny
Allow from all
</Directory>
ErrorLog /websites/name1.com/logs/name1.sys.qualiproj.error_log
CustomLog /websites/name1.com/logs/name1.sys.qualiproj.access_log common
ScriptAlias /cgi-bin/ "/websites/nokia.com/cgi-bin/"
<Directory "/websites/nokia.com/cgi-bin">
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


8 . now we need to rotate the logs so we edit /etc/logrotate.conf

"/websites/name1.com/logs/name1.sys.qualiproj.access_log" /websites/name1.com/logs/name1.sys.qualiproj.error_log {
rotate 5
size=100k
sharedscripts
postrotate
/sbin/killall -HUP httpd
endscript
}


7 . Now if the client want to use mod_rewrite ( URL rewritting ) then add the folloing in the /usr/local/apache2/conf/extra/httpd-vhosts.conf

<Directory /websites/nokia.com/web>
RewriteEngine On
RewriteRule ^index.html$ bob.html
</Directory>


8. if client wants to add one omre alias for his domain Eg: www.name1.com and ftp.name1.com

ServerAlias www.name1.com ftp.name1.com


9 if client want to add custom error page then we need to add the followin in the http-vhost.conf within the vhost directive

ErrorDocument 500 http://www.devshed.com/c/a/Apache/Custom-Error-Pages-with-Apache
ErrorDocument 404 /cgcraft.gif

10. If client wants to deny certain IP from accessing his website then change the following in the vhost directive

<Directory /websites/name1.com/web>
Options -MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
AllowOverride FileInfo AuthConfig Limit
Order allow,deny
#Allow from all
Deny from 192.168.0.247
</Directory>


11. If client wants to add certin mime type for his domain wedi the vhost directive again and add the following ( eg: enables php )

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

12. if client wants to redirect visitors to another page or url then we edit the vhost directive again and add the following

Redirect /service http://www.google.com



Steps todelete website name1.com

1. delet the system user
userdel -r name1
2. delete the ftpuser
/usr/local/pureftpd/bin/pure-pw userdel name1 -f /usr/local/pureftpd/etc/pureftpd.passwd -m
3. remove move the log rotation script frm /etc/logrotate.comf for the doamin name1.com

"/websites/name1.com/logs/name1.sys.qualiproj.access_log" /websites/name1.com/logs/name1.sys.qualiproj.error_log {
rotate 5
size=100k
sharedscripts
postrotate
/sbin/killall -HUP httpd
endscript
}
5. remove the cron job ( if any ) for awstats in
/etc/cron.daily/awstatsupdate perl /websites/name1.com/webstats/tools/awstats_buildstaticpages.pl -awstatsprog=/websites/name1.com/webstats/wwwroot/cgi-bin/awstats.pl -update -config=name1.sys.qualiproj.com -dir=/websites/name1.com/web/awstats/






Steps for building awstats for name1.com

1. cp -R /usr/local/src/awstats.6.7 /webistes/name1.com/webstats
2. cp /websites/name1.com/webstats/wwwroot/cgi-bin/awstats.model.conf /websites/name1.com/webstats/wwwroot/cgi-bin/awstats.name1.sys.qualiproj.com.conf
3. mkdir /websites/name1.com/web/awstats
5 chown name1:name1 /websites/name1.com/web/awstats
4. cp -R /websites/name1.com/webstats/wwwroot/icon /websites/name1.com/web/awstats/
5 . Edit the conf file ( awstats.name1.sys.qualiproj.com.conf )

LogFile="/websites/name1.com/logs/name1.sys.qualiproj.access_log"
SiteDomain="name1.sys.qualiproj.com"
HostAliases="www.name1.sys.qualiproj.com name1.sys.qualiproj.com localhost 127.0.0.1 "
DirData="/websites/name1.com/webstats"
DirIcons="/web/awstats/icon"
DNSLookup=1

6 Run the perl script to generate /update the webstats
perl /websites/name1.com/webstats/tools/awstats_buildstaticpages.pl -awstatsprog=/websites/name1.com/webstats/wwwroot/cgi-bin/awstats.pl -update -config=name1.sys.qualiproj.com -dir=/websites/name1.com/web/awstats/
8. now we add a cron job to run this every day !
add in /etc/cron.daily/awstatsupdate

perl /websites/name1.com/webstats/tools/awstats_buildstaticpages.pl -awstatsprog=/websites/name1.com/webstats/wwwroot/cgi-bin/awstats.pl -update -config=name1.sys.qualiproj.q.com -dir=/websites/name1.com/web/awstats/


7. To add advenced browser security to this folder ( /websites/name1.com/web/awstats ) we first generatea password for the user

/usr/local/apache2/bin/htpasswd -c /websites/privatefolderpasswd/name1.com/htpasswd name1

enter a new password
8. Then we edit the vhost file for name1.com located in /usr/local/apache2/conf/extra/httpd-vhosts.conf
In the Vhost directive we add the following

<vhost>
.
.
.<Directory /websites/nokia.com/web/awstats>
AllowOverride AuthConfig
AuthName "MyPrivateStuff"
AuthType Basic
AuthGroupFile /dev/null
AuthUserFile /websites/privatefolderpasswd/name1.com/htpasswd
AuthName Enterpassword
Require valid-user
</Directory>
</vhost>

done !!
-------------------
Regards
Agnello

No comments:

Other Articles

Enter your email address: