Category Archives: apache2.2

apache2 default home page not loading after serer migration

Hi recently got my server migrated and its IP got changed.

When i try to open my IP in the browser, the Apache 2 default home page which should load up is not loading, not sure if its cause of IP chnage, which i highly doubt.

I am getting : 404 not found

The requested URL / was not found on this server.

Tried all the possible searches and did R & D, but couldn't solve.

Following steps checked:

1) Apache 2 server running

2) mod_rewrite enabled

2) tail -f apache errors there

Below is my apache2.conf file


<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied

<Directory /usr/share>
    AllowOverride None
    Require all granted

<Directory /var/www/html>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted

My etc\apache2\sites-available\000-default.conf file

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName localhost
ServerAdmin [email protected]
DocumentRoot /var/www/html

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
 #vim: syntax=apache ts=4 sw=4 sts=4 sr noet

What are the other possibilities that i need to check to solve this??

Create Apache access.log and error.log into one visrtual host for some application installed into one website

Good evening, i need help to create different Apache logs into my single virtual host to each other of my applications installed into my website on that virtual host

i mean this i have this website into that website i have some applications like

i have only one virtual host and only one access.log and one error.log to all of this 3 application, i want to modify that virtual host to have one access.log and one error.log for every application into my website

htaccess redirect based on query parameter value

My application used to do language switching using a lang.php file. A URL to redirect to English for /path/to/page.php?foo=bar would look like this:


Recently there has been some changes to accept a lang query parameter on all pages. So this URL is nicer:


I'd like to be able to add a .htaccess file to all the locations that I have a lang.php file in order to keep the existing URL working without the lang.php file. Is this possible?

The RewriteRules must be completely relative to lang.php as the application is running on different hostnames and paths.

I took a stab at it based on the answer here but this is giving me a 404:

RewriteCond %{REQUEST_FILENAME} lang.php$
RewriteCond %{QUERY_STRING} (?:^|&)uri=([^&]+) [NC]
RewriteRule lang.php - [E=LANG_REDIR_URI:%1]

RewriteCond %{REQUEST_FILENAME} lang.php$
RewriteCond %{QUERY_STRING} (?:^|&)lang=([^&]+) [NC]
RewriteRule lang.php - [E=LANG_REDIR_LANG:%1]

RewriteCond %{REQUEST_FILENAME} lang.php$
RewriteRule . %{LANG_REDIR_URI}e [L,R=temporary]

The uri parameter may already have query parameters (as in the examble above), and the code should not make the application vulnerable to an open redirect vulnerability.

provision IP ranges in Apache 2.2

We are on the legacy Apache httpd version 2.2.22 in our organisation. Got a task to provision three set of IP ranges of submask /23(2) and /24(1). Have been provisioning Individual IPs so far as below:

RewriteCond %{REMOTE_ADDR} !^1XX.1XX.1XX.2XX

Could someone please guide me on which modules to import and how to get the aforementioned done please. Thanks a lot.

apache 2.2, You don’t have permission to access / on this server

I'm getting the following typical error:

You don't have permission to access / on this server on enable

I couldn't solve the problem with the typical answers. The website that I'm trying to access is throwing me the above message.

I found a "solution" and is comment the following lines

#<Directory />
#    Options None
#    Order deny,allow
#    AllowOverride None
#    Allow from all

I said "solution" because yesterday works great with those lines. After making a pull in my server to renew some files from my Laravel project I'm starting to get that message.

Also, if I comment those lineas I have to comment "-FollowSymLinks" from my document root:

<Directory "/var/www/html">
#   Options -FollowSymLinks
    Options -indexes -ExecCGI -Includes
    AllowOverride None
    Order allow,deny
    Allow from all
    <LimitExcept GET POST HEAD>
        deny from all

I don't know what's going on with my Centos 6.8 server (Apache 2.2 version).

To sum up, this is my virtualhost where my laravel project run:

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/html/
    Redirect permanent /
    ErrorLog /var/www/html/
    CustomLog /var/www/html/ common
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/
    SSLCertificateKeyFile /etc/letsencrypt/live/
    SSLCertificateChainFile /etc/letsencrypt/live/
    <Directory /var/www/html/>
        LimitRequestBody 5242880
        AllowOverride All
        Allow from all
        <LimitExcept GET POST HEAD>
            deny from all

Thanks for helping!

Apache : random timeout on my virtual hosts

I got a strange issue with my debian server Apache v2.2

All websites, on every ip address, are randomly generating a ERR_CONNECTION_TIMEOUT (about each 10 pages loads), except one (the main ip)

  • Apache config is basic but OK
  • Virtual host config is basic too :

    ServerAlias website
    DocumentRoot /var/www/website/
    <Directory /var/www/website/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride all
            Order allow,deny
            allow from all

  • My interfaces.conf looks like this :

    auto eth0
    iface eth0 inet static
    address xxx.xx.xx.xx (the only IP which works)
    gateway xxx.xx.xx.254
    post-up /sbin/ifconfig eth0:0 netmask broadcast
    post-down /sbin/ifconfig eth0:0 down
    post-up /sbin/ifconfig eth0:1 netmask broadcast
    post-down /sbin/ifconfig eth0:1 down
    post-up /sbin/ifconfig eth0:2 netmask broadcast
    post-down /sbin/ifconfig eth0:2 down

So : the only website which works well (never timeout) is the one on the first IP address. The websites on the the other addresses are doing a connect timeout error every 5..10 pages load.

Note that this problem appeared a few days ago on a server which works well since 2 years.

Any idea ?


django- how to deploy same project different url

i want to develop two project with same look with different data because of that i duplicated my poject as project2. now i have two projects like project1 and project2.

i configure like below. if i call i am getting project2 result(no problem getting correct result). if i call i am getting project2 only not getting project1 result. Help me how to solve this. is there any change require to conf file?


Include sites-enabled/
WSGIPythonPath /var/www/project2/blog:/var/www/project1/blog


<Directory "/var/www/">
        options Indexes FollowSymLinks
        AllowOverride None
        # Require all granted



<VirtualHost *:80>
        ServerAdmin [email protected]
        Errorlog /var/www/logs/error.log
        CustomLog /var/www/logs/custom.log combined
        WSGIScriptAlias /project2 /var/www/project2/blog/blog/
        <Directory "/var/www/project2/">
                Options FollowSymLinks
                AllowOverride None

        WSGIScriptAlias / /var/www/project1/blog/blog/
        Alias /static /var/www/project1/blog/static
        # Set access permission
        <Directory "/var/www/project1/">
                Options FollowSymLinks
                AllowOverride None


Setting a conditional variable in an OHS configuration file

I am currently trying to change the headers.conf file which is part of the httpd.conf file. What I need to do is to echo back the incoming HTTP roaming header or set it to another value depending on the incoming X-WSB-Identity header. Thus if the X-WSB-Identity equals '12345678910' then echo the X-WSB-Roaming header with the default value, otherwise print the header with a custom value.

Case 1:

Header echo [Xx]-[Ww][Ss][Bb]-[Rr][Oo][Aa][Mm][Ii][Nn][Gg]

Case 2:

Header set X-WSB-Roaming "20820"

I've checked the documentation but unfortunately did not manage to find a solution.

In addition I checked those two stack questions but still no progress:

My guess is that I've failed due to the old version of the server I am using. Any help would be much appreciated.

CASAuthNHeader mod_auth_cas, dont print user info headers

I am currently working on securing a PHP application with Apache mod_auth_cas. I managed to authenticate users, get the cookie and generate the cookie file with user information. However, I am facing the following issue:

The module is not writing the HTTP Headers with the user info. I do not know why the user info is not displayed when the login is successful. The validation in place is SAML.

This is my mod_auth_config:

<IfModule !ssl_module>
    LoadModule ssl_module modules/
LoadModule auth_cas_module modules/

CASVersion 2
CASDebug On

CASLoginURL http://********/index.html
CASValidateURL https://**********/cas/samlValidate
CASValidateSAML On

<VirtualHost *:8010>
    DocumentRoot *********
    ErrorLog logs/cas_error_log
    CustomLog logs/cas_access_log combined
    LogLevel debug

    <Location /secured.php>
        Authtype CAS
        require valid-user

        CASScope /

        CASAuthNHeader CAS_firstname
        CASAuthNHeader CAS_userType



This is my secure page with the headers:

Response Headers:

Content-Length:842`enter code here`
Content-Type:text/html; charset=UTF-8
Date:Fri, 20 Jan 2017 10:02:22 GMT
Server:Apache/2.2.15 (Oracle)

Request Headers:

Accept-Encoding:gzip, deflate, sdch
Cookie:_ga=GA1.1.2137298612.1484900359; # MOD_AUTH_CAS=1efb0b1dd5ad5a3a8d1337ddf0948115; BCSI-CS-92a12fdef0366f25=2
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36

SAML Cache Cookie:

<attribute name="firstname">

<attribute name="userType">

PD: I tried changing prefix, using one without underscore but unsuccessfully.