Tikejhya: Ashish Nepal


Category: Httpd (Page 1 of 2)

X-Forwarded-For allow deny apache [setenvif]

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

<Location />
SetEnvIf X-Forwarded-For ^192.168.19. proxy_env
Order Deny,Allow
Deny from All
Allow from env=proxy_env

Proxy Balancer

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

How to redirect http request to other server or localhost diff port using proxy balancer.


       ProxyPass / balancer://cluster/
       ProxyPassReverse /  balancer://cluster/

vhost.conf sample

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Running several name-based web sites on a single IP address.

# kb.ashishnepal.com

ServerAdmin admin@ashishnepal.com
ServerName kb.ashishnepal.com

RedirectMatch (.*) https://kb.ashishnepal.com$1

ssl.conf sample

LoadModule ssl_module modules/mod_ssl.so


        ServerAdmin admin@ashishnepal.com
        ServerName  kb.ashishnepal.com
        ServerAlias xx.ashishnepal.com
        Alias /phpMyadmin        /www/kb.ashishnepal.com/phpMyadmin

        ErrorLog /logs/www/kb.ashishnepal.com/ssl_error_log
        CustomLog /logs/www/kb.ashishnepal.com/ssl_access_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x "%r" %b"

        SSLEngine On

        SSLProtocol -ALL +SSLv3 +TLSv1
        SSLHonorCipherOrder on
        SSLCertificateFile /etc/httpd/conf/certs/kb.ashishnepal.com.crt
        SSLCertificateKeyFile /etc/httpd/conf/certs/kb.ashishnepal.com.key
        SSLCertificateChainFile /etc/httpd/conf/certs/ca.crt

        SetEnvIf User-Agent ".*MSIE.*" 
                nokeepalive ssl-unclean-shutdown 
                downgrade-1.0 force-response-1.0

                Order deny,allow
                Allow from all
                Allow from

httpd.conf sample

httpd.conf sample

#This can be changed according to your server configuration root path
ServerRoot "/etc/httpd"

# Listen to IP address

# Modules: default and installed modules
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule info_module modules/mod_info.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.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
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule version_module modules/mod_version.so
LoadModule php5_module	/usr/lib64/httpd/modules/libphp5.so

# Multi-Processing Module (MPM)
# The main thread is responsible for launching child worker threads which listen for connections and serve them when they arrive.

#This Multi-Processing Module is optimized for Windows NT.

# Running as user apache
User apache

#Running as group apache
Group apache

ServerAdmin admin@ashishnepal.com
ServerName kb.ashishnepal.com:80
ServerName kb.ashishnepal.com:443
DocumentRoot "/data/www/"

    Options FollowSymLinks Includes ExecCGI
    AllowOverride All

    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all

    DirectoryIndex index.html index.htm index.html.var app.php

# Deny .htaccess folder access

    Order allow,deny
    Deny from all
    Satisfy All

# Deny .svn folder access

Order allow,deny
Deny from all
Satisfy All

ErrorLog "/var/log/httpd/error_log"

LogLevel warn

    LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
    LogFormat "%h %l %u %t "%r" %>s %b" common

      LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio

    CustomLog "/var/log/httpd/access_log" combined

DefaultType text/plain

    TypesConfig /etc/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddHandler cgi-script .cgi .pl

ErrorDocument 400 "Error 400"

TraceEnable Off

Include conf.d/vhosts.conf
Include conf.d/ssl.conf

SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

Hidding .svn files to be accessible from.

How to protect .svn directory in APACHE.

Hidding .svn files to be accessible from.

vi /etc/httpd/conf/httpd.conf

Order allow,deny
Deny from all
Satisfy All

301 rewriterule

how to write 301 rewrite rule with wordpress website.

i.e. i have a website called tikejhya.com and i want to redirect specific pages to ashishnepal.com/specific directories ..

RewriteCond %{HTTP_HOST} ^www.ashishnepal.com$
RewriteRule ^deal/(.*)$ “http://www.ashishnepal.com/deal/$1” [R=301,L]
RewriteRule ^page/(.*)$ “http://www.ashishnepal.com/page/$1” [R=301,L]
RewriteRule ^deal/view/(.*)$ “http://www.ashishnepal.com/deal/view/$1” [R=301,L]

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

How to make Asterisk accept HTTPS

How to make Asterisk accept HTTPS

yum install mod_ssl

Change your ssl.conf setting with required certificate file and document dir


# Redirect all requests to port 80 to port 443 SSL via mod_rewrite

# make sure the module is loaded and switched on

LoadModule rewrite_module /usr/lib/httpd/modules/mod_rewrite.so

RewriteEngine on

# The line below sets the rewrite condition for mod_rewrite.so.
# That is, if the server port does not equal 443, then this condition is true

ReWriteCond %{SERVER_PORT} !^443$

# redirect rule

RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

Disable php(or script) execution within directory

// Apache

disable PHP script execution in upload attachment directory

php_flag engine off

// Nginx

location /sites/default/files/ {
location ~ .*.(php)?$
deny all;

Prevent logging something lighttpd

IN some case you may well want to prevent logging in lighttpd

$HTTP["url"] =~ "(?i).*.(something to not log)(?.*)?$" {
  accesslog.filename = "/dev/null"

Page 1 of 2

Powered by WordPress & Theme by Anders Norén