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 logs..no errors there

Below is my apache2.conf file

etc\apache2\apache2.conf

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

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

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

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 www.example.com
#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
</VirtualHost>
 #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 mywebsite.it into that website i have some applications like mywebsite.it/test mywebsite.it/ok mywebsite.it/apache

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:

/path/to/lang.php?lang=en-CA&uri=%2Fpath%2Fto%2Fpage.php%3Ffoo%3Dbar

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

/path/to/page.php?foo=bar&lang=en-CA

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
#</Directory>

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
    </LimitExcept>
</Directory>

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]
    ServerName www.myhosting.com
    DocumentRoot /var/www/html/myhosting.com/public
    ServerAlias myhosting.com
    Redirect permanent / https://www.myhosting.com
    ErrorLog /var/www/html/myhosting.com/error.log
    CustomLog /var/www/html/myhosting.com/requests.log common
</VirtualHost>
<VirtualHost myhosting.com:443>
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/www.myhosting.com/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/www.myhosting.com/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/www.myhosting.com/chain.pem
    <Directory /var/www/html/myhosting.com/public>
        LimitRequestBody 5242880
        AllowOverride All
        Allow from all
        <LimitExcept GET POST HEAD>
            deny from all
        </LimitExcept>

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 :

    <VirtualHost xx.xxx.xxx.xxx:80>
    ServerName www.website.fr
    ServerAlias website
    DocumentRoot /var/www/website/
    
    <Directory /var/www/website/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
    </Directory>
    

  • My interfaces.conf looks like this :

    auto eth0
    iface eth0 inet static
    address xxx.xx.xx.xx (the only IP which works)
    netmask 255.255.255.0
    gateway xxx.xx.xx.254
    
    post-up /sbin/ifconfig eth0:0 xx.xxx.xxx.xxx netmask 255.255.255.255 broadcast   xx.xxx.xxx.xxx
    post-down /sbin/ifconfig eth0:0 down
    post-up /sbin/ifconfig eth0:1 xx.xxx.xxx.xxx netmask 255.255.255.255 broadcast xx.xxx.xxx.xxx
    post-down /sbin/ifconfig eth0:1 down
    post-up /sbin/ifconfig eth0:2 xx.xxx.xxx.xxx netmask 255.255.255.255 broadcast xx.xxx.xxx.xxx
    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 ?

Thanks.

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 www.xyz.com/project2 i am getting project2 result(no problem getting correct result). if i call www.xyz.com/project1 i am getting project2 only not getting project1 result. Help me how to solve this. is there any change require to conf file?

apache2.conf

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

ServerName 107.170.00.04

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

</Directory>

/etc/apache2/sites-available/default

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

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

</VirtualHost>

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/mod_ssl.so
</IfModule>
LoadModule auth_cas_module modules/mod_auth_cas.so

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

    </Location>

</VirtualHost>

This is my secure page with the headers:

Response Headers:

Age:0
Connection:Keep-Alive
Content-Length:842`enter code here`
Content-Type:text/html; charset=UTF-8
Date:Fri, 20 Jan 2017 10:02:22 GMT
Proxy-Connection:Keep-Alive
Server:Apache/2.2.15 (Oracle)
X-Powered-By:PHP/5.3.3

Request Headers:

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Cookie:_ga=GA1.1.2137298612.1484900359; # MOD_AUTH_CAS=1efb0b1dd5ad5a3a8d1337ddf0948115; BCSI-CS-92a12fdef0366f25=2
Host:*********:8010
Proxy-Connection:keep-alive
Referer:http://****:8010/index.php?service=http%3a%2f%2f********%3a8010%2fsecured.php
Upgrade-Insecure-Requests:1
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">
        <value>Marcos</value>   
</attribute>


<attribute name="userType">
        <value>PS</value>   
</attribute>

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