A Blog about technology, linux, peer2peer, cool new downloads and software development.
Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Sunday, April 4, 2010

php - how to log errors to a log file in the current directory

$ vim debug.php


$ touch error_log.log
$ chmod a+rw error_log.log

[browse to the debug.php page and then cat the log file]

Tuesday, November 24, 2009

how to add/remove www. from domain name in .htaccess


to add/remove www. with mod rewrite :
cd public_html
vim .htaccess

# remove www
RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]


# insert www
RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Saturday, June 20, 2009

apache mod_proxy how to


Links :
-------
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypassreverse
http://apache.webthing.com/mod_proxy_html/ --> http://www.apachetutor.org/admin/reverseproxies

Modules :
---------
yum install httpd-devel
yum install libxml2-devel

Configuration:
--------------
cp proxy_html.conf /etc/httpd/conf/
vim /etc/httpd/conf/httpd.conf

LoadFile /usr/lib/libxml2.so
LoadModule proxy_html_module modules/mod_proxy_html.so
Include conf/proxy_html.conf

(
Also Check :
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
)

Vhost :
-------
Example :

<VirtualHost 208.109.169.70:80>
ServerAdmin "webmaster@upframr.com"
ServerName upframr.com
ServerAlias www.upframr.com
MIMEMagicFile /dev/null
CustomLog logs/upframr.com_access_log "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
ErrorLog logs/upframr.com_error_log

DocumentRoot "/home/admin2/public_html"
<Directory "/home/admin2/public_html">
Options +Indexes +FollowSymLinks
Order allow,deny
Allow from all
AllowOverride All
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>

Alias /mod_perl "/home/admin2/public_html/mod_perl"
<Directory "/home/admin2/public_html/mod_perl">
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
</Directory>

<Location /perl-status>
SetHandler perl-script
PerlResponseHandler Apache::Status
Order deny,allow
Deny from all
Allow from upframr.com
</Location>

ScriptAlias /cgi-bin "/home/admin2/public_html/cgi-bin"

Alias /usage /var/www/stats/upframr.com
<Directory /var/www/stats/upframr.com>
Order allow,deny
Allow from all
</Directory>

<Location /usage>
Order allow,deny
Allow from all
</Location>
</VirtualHost>