Showing posts with label Apache. Show all posts
Showing posts with label Apache. Show all posts

Apr 28, 2014

Apache - httpd dead but pid file exists

In your apache status command, you will receive message httpd dead but pid file exists. Below are possible, solution to fixed.


Restart your apache.
# /etc/init.d/http restart
or
services httpd restart


TIPS: To stop this possible errors, After you install shared libraries in system. Try to restart this service, or reboot your system to sure that all possible services affected, will include in the affected module.

Oct 24, 2013

Apache: How to log the Original IP or X-Forwarded-For in you access log

You need to modify you apache configuration and find the related data below and update according to data below.

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b " combined
CustomLog /var/log/httpd/access_log combined

Oct 4, 2013

Apache: configure apache .htaccess to filter incomming request behind proxy

Normally we write we configure apache rewrite rule with underscore on every word separator. See below.

RewriteCond %{REMOTE_ADDR} 120.28.70.239
RewriteCond %{REQUEST_URI} phpinfo.php

For custom server variable made separated by dash(-) on every word and has a prefix of HTTP:. This mean to set X-FORWARDED-FOR see below.
RewriteCond %{HTTP:X-FORWARDED-FOR} 120.28.70.239

Sep 30, 2013

TipsAndTrick: What maid my apache stop?

This error came-up after I installed the subversion on my machine.

Mon Sep 30 16:07:08 2013] [notice] SIGHUP received.  Attempting to restart
httpd: Syntax error on line 223 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 of /etc/httpd/conf.d/php.conf: Cannot load /etc/httpd/modules/libphp5.so into server: /usr/lib64/libxml2.so.2: symbol gzopen64, version ZLIB_1.2.3.3 not defined in file libz.so.1 with link time reference

I cant imaging that apache dependencies has also relation to subversion dependency package. But this is really happen.
As verify my latest Installed and update, zlib was one of them.
$ sudo tail -n 20 /var/log/yum.log
Sep 30 05:13:46 Updated: zlib-1.2.5-7.11.amzn1.x86_64
Sep 30 05:13:46 Updated: apr-1.4.6-1.10.amzn1.x86_64
Sep 30 05:13:46 Installed: libtasn1-2.3-3.4.amzn1.x86_64
Sep 30 05:13:47 Installed: gnutls-2.8.5-10.10.amzn1.x86_64
Sep 30 05:13:47 Installed: neon-0.29.5-1.10.amzn1.x86_64
Sep 30 05:13:47 Installed: subversion-libs-1.7.13-1.32.amzn1.x86_64
Sep 30 05:13:48 Installed: subversion-1.7.13-1.32.amzn1.x86_64
Sep 30 05:13:48 Updated: libxml2-2.7.8-10.26.amzn1.x86_64
Sep 30 05:13:48 Updated: zlib-1.2.5-7.11.amzn1.i686

Solution:
By rebooting my system apache works and run again like miracle. This case I learn something, that in every update made in your system, find a time to reboot. :)


Happy rebooting

Jan 29, 2013

How to configure fastcgi(mod_fcgid) for apache.

Install mod_fcgid if not yet install.
yum install mod_fcgid

Edit http.conf, but be sure to backup before do any changes.
DocumentRoot "/var/www/html"

# FcgidMaxRequestsPerProcess should be <= PHP_FCGI_MAX_REQUESTS
# The example PHP wrapper script overrides the default PHP setting.
FcgidMaxRequestsPerProcess 10000

# Uncomment the following line if cgi.fix_pathinfo is set to 1 in
# php.ini:
# FcgidFixPathinfo 1

.....

<Document "/var/www/html">
AddHandler fcgid-script .php
Options +ExecCGI
FcgidWrapper /usr/bin/php-wrapper .php

.......

</Document>

As you notice I did not use an Alias to specific directory. Since, I decide to use fast-cgi rather than mod_php, I modify Document either.


Create the wrapper file /user/bin/php-cgi-wrapper
#!/bin/sh
# Set desired PHP_FCGI_* environment variables.
# Example:
# PHP FastCGI processes exit after 500 requests by default.
PHP_FCGI_MAX_REQUESTS=10000
export PHP_FCGI_MAX_REQUESTS

# Replace with the path to your FastCGI-enabled PHP executable
exec /usr/bin/php-cgi

Change the wrapper permission to executable.
chmod 755 /user/bin/php-cgi-wrapper

Oct 2, 2012

How to enable/install apache mod_rewrite?

From my long time using Redhat. I familiarize how yum work for it. But sadly I switch to Suse cousing teh fedora 17 can't work to change the brightness on my HP Laptop. :((

But now, in the help of google I found it as simple, just need as root access in your terminal and type the command.
a2enmod rewrite

Besure also to to change your apache setting.
From
AllowOverride None
To
AllowOverride All

Happy reading and hope will work to you too.

Aug 28, 2012

Tomcat: Change timezone setting.

As default tomcat use GMT timezone. To set this one, modify your catalina.sh or starup.sh a the location before the execution of the tomcat boostrap and add data below.
$JAVA_OPTS="$JAVA_OPTS -Duser.timezone=Asia/Manila"
Please find the timezone By Continent or in Asia

May 19, 2011

HTACCESS: Rewrite all HTTP request to HTTPS


RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]


Reference:
1 http://www.askapache.com/htaccess/ssl-example-usage-in-htaccess.html
2 http://joseph.randomnetworks.com/2004/07/22/redirect-to-ssl-using-apaches-htaccess/