apache2 problem

Discussion in 'Server Operation' started by laser144, Feb 20, 2007.

  1. laser144

    laser144 New Member

    Hi,

    Having switched ISP, I am having problems with my webserver (LAMP -
    Debian Sarge, Apache2). It used to work like a charm with my old ISP and all I changed is the first ServerName entry (which I copied from my IPCops main page).

    For some reason I cannot access the DocumentRoot (/var/www/
    sailmaster.nl/) folder for the sailmaster website (www.sailmaster.nl).
    I can access www.sailmaster.nl/administrator and phpMyAdmin, which is
    a symlink in the /var/www/sailmaster.nl/ directory. There are no
    problems connecting to www.gijpstuiver.nl

    Setting up the server while connected via my previous ISP, I found out
    that with virtual hosting you always have to have the hostname for the
    IP-address of the server first in the file which sets the virtual
    hosts. My modem is in bridged mode, so the IP-address and the hostname
    is passed on to the 'red' Ethernet card on my IPCop firewall, which is
    set to DHCP. The IP-address is 84.245.34.233, the hostname is
    84-245-34-233.dsl.cambrium.nl

    I can ping all hostnames and IP-addresses (the internal IP-address of
    my server as well). I think it must be some DNS-related problem, but I
    haven't got a clue how to solve it.

    Any help or advice is greatly appreciated!

    Underneath is a copy of my /etc/apache2/sites-available/default

    Regards,

    Andy

    NameVirtualHost *:80

    <VirtualHost *:80>
    ServerName 84-245-34-233.dsl.cambrium.nl
    ServerAdmin webmaster@sailmaster.nl
    DocumentRoot /var/www/

    <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    # This directive allows us to have apache2's default start page
    # in /apache2-default/, but still have / go to the right place
    RedirectMatch ^/$ /apache2-default/
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined
    ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

    </VirtualHost>

    <VirtualHost *:80>
    ServerName www.sailmaster.nl
    ServerAlias sailmaster.nl *.sailmaster.nl
    ServerAdmin webmaster@sailmaster.nl
    DocumentRoot /var/www/sailmaster.nl/
    </VirtualHost>

    <VirtualHost *:80>
    ServerName www.gijpstuiver.nl
    ServerAlias gijpstuiver.nl *.gijpstuiver.nl
    ServerAdmin webmaster@sailmaster.nl
    DocumentRoot /var/www/gijpstuiver.nl/gallery2/
    </VirtualHost>
     
  2. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    What's the output of
    Code:
    ls -la /var/www/sailmaster.nl/
    ? Any errors in Apache's error log?
     
  3. laser144

    laser144 New Member

    Hi Falko,

    The output of ls -la /var/www/sailmaster.nl/:


    drwxrwxrwx 16 root root 4096 2007-02-20 10:23 .
    drwxr-xr-x 5 root root 4096 2006-12-19 14:21 ..
    drwxr-xr-x 9 root root 4096 2006-05-19 21:36 administrator
    drwxrwxrwx 2 root root 4096 2006-08-28 21:20 cache
    -rwxr-xr-x 1 root root 99938 2006-12-24 21:22 CHANGELOG.php
    drwxr-xr-x 24 root root 4096 2006-05-19 21:36 components
    -rw-r--r-- 1 www-data www-data 2743 2007-01-16 11:08 configuration.php
    -rwxrwxrwx 1 root root 4251 2006-08-28 21:20 configuration.php-dist
    -rwxrwxrwx 1 root root 3429 2006-08-28 21:20 COPYRIGHT.php
    drwxrwxrwx 2 root root 4096 2006-08-28 21:20 editor
    drwxr-xr-x 2 root root 4096 2006-12-21 13:25 files
    drwxr-xr-x 8 root root 4096 2006-12-20 08:51 gallery2
    -rwxrwxrwx 1 root root 3535 2007-01-22 10:47 globals.php
    drwxrwxrwx 3 root root 8192 2007-01-09 09:54 help
    -rwxr-xr-x 1 root root 4829 2007-02-20 10:23 .htaccess
    -rwxr-xr-x 1 root root 4829 2006-12-24 21:22 htaccess.txt
    drwxrwxrwx 8 root root 4096 2007-01-08 10:02 images
    drwxrwxrwx 10 root root 4096 2007-01-09 09:54 includes
    -rwxr-xr-x 1 root root 5223 2006-12-24 21:22 index2.php
    -rwxr-xr-x 1 root root 8491 2006-12-24 21:22 index.php
    -rwxr-xr-x 1 root root 4376 2006-12-24 21:22 INSTALL.php
    drwxrwxrwx 2 root root 4096 2007-01-09 09:54 language
    -rwxrwxrwx 1 root root 17977 2006-08-28 21:20 LICENSE.php
    -rwxrwxrwx 1 root root 710 2006-08-28 21:20 mainbody.php
    drwxrwxrwx 7 root root 4096 2006-08-28 21:20 mambots
    drwxrwxrwx 5 root root 4096 2007-01-21 14:59 media
    drwxrwxrwx 6 root root 4096 2007-01-21 14:59 modules
    -rwxrwxrwx 1 root root 2474 2006-08-28 21:20 offlinebar.php
    -rwxr-xr-x 1 root root 4929 2006-12-24 21:22 offline.php
    -rwxrwxrwx 1 root root 709 2006-08-28 21:20 pathway.php
    lrwxrwxrwx 1 root root 21 2006-12-19 19:28 phpmyadmin -> /usr/share/phpmyadmin
    -rwxrwxrwx 1 root root 286 2006-08-28 21:20 robots.txt
    drwxrwxrwx 6 root root 4096 2006-12-19 21:00 templates

    From Apache's log:

    ...snip...

    192.168.0.99 - - [05/Mar/2007:16:26:52 +0100] "GET /phpmyadmin/themes/original/img/logo_right.png HTTP/1.1" 304 - "http://192.168.1.2/phpmyadmin/" "Mozilla/5
    .0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/20070216 Firefox/1.5.0.10"
    192.168.0.99 - - [05/Mar/2007:16:33:54 +0100] "GET /administrator/ HTTP/1.1" 200 2116 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/20
    070216 Firefox/1.5.0.10"
    192.168.0.99 - - [05/Mar/2007:16:34:01 +0100] "GET / HTTP/1.1" 302 380 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/20070216 Firefox/
    1.5.0.10"
    192.168.0.99 - - [05/Mar/2007:16:34:01 +0100] "GET /apache2-default/ HTTP/1.1" 404 1173 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/
    20070216 Firefox/1.5.0.10"
    192.168.0.99 - - [05/Mar/2007:17:06:59 +0100] "GET /administrator/ HTTP/1.1" 200 2116 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/20
    070216 Firefox/1.5.0.10"
    192.168.0.99 - - [05/Mar/2007:17:07:02 +0100] "GET / HTTP/1.1" 302 380 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/20070216 Firefox/
    1.5.0.10"
    192.168.0.99 - - [05/Mar/2007:17:07:02 +0100] "GET /apache2-default/ HTTP/1.1" 404 1173 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/
    20070216 Firefox/1.5.0.10"
    192.168.0.99 - - [05/Mar/2007:17:07:04 +0100] "GET /phpmyadmin/ HTTP/1.1" 200 12074 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/2007
    0216 Firefox/1.5.0.10"
    192.168.0.99 - - [05/Mar/2007:17:07:04 +0100] "GET /phpmyadmin/css/phpmyadmin.css.php?lang=nl&js_frame=right&js_isDOM=1 HTTP/1.1" 200 12240 "http://192.168.1
    .2/phpmyadmin/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/20070216 Firefox/1.5.0.10"
    192.168.0.1 - - [05/Mar/2007:18:41:19 +0100] "GET / HTTP/1.1" 302 384 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/20070216 Firefox/1
    .5.0.10"
    192.168.0.1 - - [05/Mar/2007:18:41:19 +0100] "GET /apache2-default/ HTTP/1.1" 404 1175 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/2
    0070216 Firefox/1.5.0.10"
    192.168.0.1 - - [05/Mar/2007:18:41:19 +0100] "GET /favicon.ico HTTP/1.1" 404 1175 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/200702
    16 Firefox/1.5.0.10"
    84.16.231.53 - - [05/Mar/2007:22:34:40 +0100] "" 414 429 "-" "-"
    84.16.231.53 - - [06/Mar/2007:04:49:17 +0100] "" 414 429 "-" "-"
    192.168.0.99 - - [06/Mar/2007:09:23:36 +0100] "GET /administrator/ HTTP/1.1" 200 2116 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/20
    070216 Firefox/1.5.0.10"
    192.168.0.99 - - [06/Mar/2007:09:23:37 +0100] "GET / HTTP/1.1" 302 380 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/20070216 Firefox/
    1.5.0.10"
    192.168.0.99 - - [06/Mar/2007:09:23:37 +0100] "GET /apache2-default/ HTTP/1.1" 404 1173 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/
    20070216 Firefox/1.5.0.10"
    192.168.0.99 - - [06/Mar/2007:09:42:37 +0100] "GET /administrator/ HTTP/1.1" 200 2116 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/20
    070216 Firefox/1.5.0.10"
    192.168.0.99 - - [06/Mar/2007:09:42:39 +0100] "GET / HTTP/1.1" 302 380 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/20070216 Firefox/
    1.5.0.10"
    192.168.0.99 - - [06/Mar/2007:09:42:39 +0100] "GET /apache2-default/ HTTP/1.1" 404 1173 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.0.10) Gecko/
    20070216 Firefox/1.5.0.10"

    /...snip...

    BTW: I just got this back from http://www.dnsreport.com/tools/dnsreport.ch?domain=sailmaster.nl

    ...snip...
    WARN TCP Allowed WARNING: One or more of your DNS servers does not
    accept TCP connections. Although rarely used, TCP connections are
    occasionally used instead of UDP connections. When firewalls block the
    TCP DNS connections, it can cause hard-to-diagnose problems. The problem
    servers are:

    212.79.232.3: Timeout. 195.245.199.130: Timeout. 212.79.243.3: Timeout.
    WARN Single Point of Failure WARNING: Although you have at least 2 NS
    records, there is a chance that they may both point to the same server
    (one of our two tests shows them being different, the other is unsure;
    it appears that there are one or more firewall(s) that intercept and
    alter DNS packets (some versions of Linux reportedly have a built-in
    firewall that does this, too)), which would result in a single point of
    failure. You are required to have at least 2 nameservers per RFC 1035
    section 2.2.
    /...snip...

    Could that be part of the problem?

    Regards,

    Andy
     
    Last edited: Mar 6, 2007
  4. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    You posted Apache's access log, not the error log.

    What's in /var/www/sailmaster.nl/.htaccess?

    The DNS serveri s responding fine, so I don't think that's the problem.
     
  5. laser144

    laser144 New Member

    Ooops...

    Error log:

    [Tue Mar 06 12:27:41 2007] [error] [client 213.126.142.46] File does not exist: /var/www/sailmaster.nl/favicon.ico
    [client 74.6.75.47] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [Tue Mar 06 14:30:57 2007] [error] [client 84.16.231.53] request failed: URI too long (longer than 8190)
    [Tue Mar 06 14:43:58 2007] [error] [client 66.249.72.50] File does not exist: /var/www/gijpstuiver.nl/gallery2/robots.txt
    [Tue Mar 06 14:43:58 2007] [error] [client 66.249.72.50] File does not exist: /var/www/gijpstuiver.nl/gallery2/gallery2
    [client 74.6.72.72] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [client 72.30.177.160] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [client 74.6.70.90] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [Tue Mar 06 19:54:56 2007] [error] [client 83.71.188.242] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DF
    ind:)
    [Tue Mar 06 20:36:38 2007] [error] [client 84.16.231.53] request failed: URI too long (longer than 8190)
    [Tue Mar 06 21:53:12 2007] [error] [client 74.6.75.31] File does not exist: /var/www/gijpstuiver.nl/gallery2/robots.txt
    [client 74.6.71.88] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [client 74.6.69.205] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [Wed Mar 07 04:05:09 2007] [error] [client 84.16.231.53] request failed: URI too long (longer than 8190)
    [client 74.6.72.73] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [client 74.6.67.101] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [client 65.54.188.60] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [client 65.54.188.60] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [Wed Mar 07 08:17:14 2007] [error] [client 213.254.226.49] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.D
    Find:)
    [Wed Mar 07 13:39:25 2007] [error] [client 84.16.231.53] request failed: URI too long (longer than 8190)
    [Wed Mar 07 15:35:47 2007] [error] [client 74.6.75.31] File does not exist: /var/www/gijpstuiver.nl/gallery2/robots.txt
    [Wed Mar 07 19:53:30 2007] [error] [client 84.16.231.53] request failed: URI too long (longer than 8190)
    [Wed Mar 07 22:58:23 2007] [error] [client 84.16.230.45] request failed: URI too long (longer than 8190)
    [client 74.6.74.169] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [Thu Mar 08 02:44:42 2007] [error] [client 66.249.72.10] File does not exist: /var/www/gijpstuiver.nl/gallery2/robots.txt
    [Thu Mar 08 03:37:59 2007] [error] [client 84.16.231.53] request failed: URI too long (longer than 8190)
    [client 74.6.68.166] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [client 65.54.188.59] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [client 74.6.71.52] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [Thu Mar 08 08:55:29 2007] [error] [client 62.75.204.167] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DF
    ind:)
    [Thu Mar 08 08:59:00 2007] [error] [client 84.16.231.53] request failed: URI too long (longer than 8190)
    [client 74.6.74.177] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat
    [client 74.6.73.85] script '/var/www/sailmaster.nl/modules.php' not found or unable to stat


    .htaccess:



    Options +FollowSymLinks

    #
    # mod_rewrite in use

    RewriteEngine On


    # Uncomment following line if your webserver's URL
    # is not directly related to physical file paths.
    # Update Your Joomla!/MamboDirectory (just / for root)

    # RewriteBase /


    ########## Begin - Joomla! core SEF Section
    ############# Use this section if using ONLY Joomla! core SEF
    ## ALL (RewriteCond) lines in this section are only required if you actually
    ## have directories named 'content' or 'component' on your server
    ## If you do not have directories with these names, comment them out.
    #
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
    RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
    RewriteRule ^(content/|component/) index.php
    #
    ########## End - Joomla! core SEF Section



    ########## Begin - 3rd Party SEF Section
    ############# Use this section if you are using a 3rd party (Non Joomla! core) SEF extension - e.g. OpenSEF, 404_SEF, 404SEFx, SEF Advance, etc
    #
    #RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
    #RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule (.*) index.php
    #
    ########## End - 3rd Party SEF Section



    ########## Begin - Rewrite rules to block out some common exploits
    ## If you experience problems on your site block out the operations listed below
    ## This attempts to block the most common type of exploit `attempts` to Joomla!
    #
    # Block out any script trying to set a mosConfig value through the URL
    RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
    # Block out any script trying to base64_encode crap to send via URL
    RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
    # Block out any script that includes a <script> tag in URL
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL
    RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL
    RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    # Send all blocked request to homepage with 403 Forbidden error!
    RewriteRule ^(.*)$ index.php [F,L]
    #
    ########## End - Rewrite rules to block out some common exploits
     
  6. martinfst

    martinfst New Member Moderator HowtoForge Supporter ISPConfig Developer

    You're missing files:
    and you have errors in your rewrite statements. You apparently have a broken Gallery2 installation, also because I don't see the default Gallery2 rewrite rules.
    indicates rewrite errors. I suggest to fix the Gallery2 install 1st (or remove the left overs if you de-installed) and then add rewritelog directive to the apache config and start debugging.
     
  7. laser144

    laser144 New Member

    Rather than debug, I opted to de a clean install on a freshly formatted HD. Based on Falko's 'The Perfect Setup' HowTo. (Copy/paste via Putty, so no typo's there) I can ping www.sailmaster.nl

    Installed Joomla again, but am still experiencing the same problems: can access www.sailmaster.nl/administrator, while www.sailmaster.nl is redirected to http://www.sailmaster.nl/apache2-default/

    However www.sailmaster.nl/index.php gets me the homepage. Where in the Apache2 configuration can I solve this and how? To get php pages processed I had to uncomment some things in /etc/apache2/mods-enabled/php4.conf which I had commented first as described the HowTo:

    <IfModule mod_php4.c>
    # AddType application/x-httpd-php .php .phtml .php3
    # AddType application/x-httpd-php-source .phps
    </IfModule>

    Any sugesstions?

    Regards,
    Andy
     
    Last edited: Mar 14, 2007
  8. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    What's the output of
    Code:
    ls -la /var/www
    ?

    I think you have to remove
    Code:
    RedirectMatch ^/$ /apache2-default/
    from /etc/apache2/sites-available/default and restart Apache.
     
  9. laser144

    laser144 New Member

    Thx a lot!

    Hi Falko,

    Commenting out ' RedirectMatch ^/$ /apache2-default/ ' solved the problem.

    Thanks for helping me, not just here on the forum, but with your HowTo's as well. They have enabled me to host small scale web-, ftp- and mailservices on a discarded office PC for a club which has no budget at all!

    Cheers!

    Andy
     
    Last edited: Mar 15, 2007

Share This Page