Can't turn of PHP for vhost

Discussion in 'Installation/Configuration' started by dmgeurts, Nov 5, 2005.

  1. dmgeurts

    dmgeurts New Member

    I have ispconfiog installed and tackled my mail problems and my DNS sub-domain issues but PHP doesn't work for vhosts.

    I uploaded to the correct directories, changed the default behaviour not to show the dir listing (-Indexes) etc. But if I want PHP for the 2 vhosts I have configured I need to turn PHP on globally. And yes I used the tick box in the site config and can see the result in the vhost file. No play though...

    My vhost file(s) seem to be correct etc but PHP files are parsed as plain text files to my browser.

    have a look at http://www.djerk.nl/info.php if you like

    Regards,
    Djerk
     
  2. falko

    falko Super Moderator

    So you turned on PHP for www.djerk.nl in ISPConfig?

    Is it possible that the name of the default Apache web site (before you installed ISPConfig) is also www.djerk.nl? Then change the ServerName directive for that default web site.
     
  3. dmgeurts

    dmgeurts New Member

    Yes I did turn on PHP for djerk.nl

    Right I'm searching for where I should change this, any pointers?

    djerk.nl wasn't there before ispconfig but it is the domain of the server itself so in a sense yes you're right.

    Thinking about the above I must add that another site (DNS isn't moved yet) on the same server has the same problem. Resolving djerk.nl being caught by the main apache config instead of a vhost config would mean that the other domain should be working...

    I'm at my wits end...
     
    Last edited: Nov 5, 2005
  4. SleeperZ

    SleeperZ ISPConfig Developer

    Its prolly somewhere in /etc/apache2/sites-enabled/000-default.

    If its not there I'd do a grep - ~$ grep -lR "djerk" /etc/apache2/ - this will tell you all the places in the apache2 directory and down that it the term djerk shows up.

    Hopefully this helps in tracking down the issue.
     
  5. dmgeurts

    dmgeurts New Member

    It must be somewhere but I have no idea. I did a search for any file containing djerk.nl but didn't find anything I'd not seen before.

    this is /etc/apache2/sites-available (symlinked to sites-enabled/000-default)

    Code:
    NameVirtualHost *
    <VirtualHost *>
            ServerAdmin webmaster@djerk.nl
    
            DocumentRoot /var/www/
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <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 ^/$ /web1/web/
            </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>
    All help appreciated btw so thx falco & SleeperZ

    Code:
    suzy:/etc/apache2# grep -lR "ServerName" /etc/
    /etc/ssl/openssl.cnf
    /etc/apache2/sites-available/web1.djerk.nl
    /etc/apache2/sites-available/web2.geurtscass.com
    /etc/apache2/sites-enabled/web1.djerk.nl
    /etc/apache2/sites-enabled/web2.geurtscass.com
    /etc/apache2/vhosts/Vhosts_ispconfig.conf
    /etc/apache2/vhosts/Vhosts_ispconfig.conf~
    /etc/proftpd.conf.orig
    /etc/proftpd.conf
    All apache2 files seem correct to me so I'm probably wrong... web1 is the 1st virtual host web2 the second.

    Vhosts_ispconfig.conf:
    Code:
    suzy:/etc/apache2# more /etc/apache2/vhosts/Vhosts_ispconfig.conf
    ###################################
    # ISPConfig vHost Configuration File
    #         Version 1.0
    ###################################
    NameVirtualHost 217.195.248.251:80
    ######################################
    # Vhost: www.djerk.nl:80
    ######################################
    <VirtualHost 217.195.248.251:80>
    ServerName www.djerk.nl:80
    ServerAdmin webmaster@djerk.nl
    DocumentRoot /var/www/web1/web
    ServerAlias djerk.nl ftp.djerk.nl
    DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm 
    default.htm
    ScriptAlias  /cgi-bin/ /var/www/web1/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    ErrorLog /var/www/web1/log/error.log
    AddType application/x-httpd-php .php .php3 .php4 .php5
    <Files *.php> ... (code ommitted)
     
    Last edited: Nov 6, 2005
  6. dmgeurts

    dmgeurts New Member

    Might a duplicate section of ###ispconfig_log### cause any trouble? It does explain to me why the vhost file is read twice. only just noticed...

    Code:
    suzy:/etc/apache2# /usr/sbin/apache2 -S      
    [Sun Nov 06 16:11:30 2005] [warn] NameVirtualHost 217.195.248.251:80 has no VirtualHosts
    VirtualHost configuration:
    217.195.248.251:80     is a NameVirtualHost
             default server www.djerk.nl (/etc/apache2/vhosts/Vhosts_ispconfig.conf:16)
             port 80 namevhost www.djerk.nl (/etc/apache2/vhosts/Vhosts_ispconfig.conf:16)
             port 80 namevhost www.geurtscass.com (/etc/apache2/vhosts/Vhosts_ispconfig.conf:69)
             port 80 namevhost www.djerk.nl (/etc/apache2/vhosts/Vhosts_ispconfig.conf:16)
             port 80 namevhost www.geurtscass.com (/etc/apache2/vhosts/Vhosts_ispconfig.conf:69)
    wildcard NameVirtualHosts and _default_ servers:
    *:*                    is a NameVirtualHost
             default server localhost.localdomain (/etc/apache2/sites-enabled/000-default:2)
             port * namevhost localhost.localdomain (/etc/apache2/sites-enabled/000-default:2)
             port * namevhost localhost.localdomain (/etc/apache2/sites-enabled/web1.djerk.nl:1)
             port * namevhost www.geurtscass.com (/etc/apache2/sites-enabled/web2.geurtscass.com:1)
    Syntax OK
    After correcting the double entry:

    Code:
    suzy:/etc/apache2# /usr/sbin/apache2 -S
    VirtualHost configuration:
    217.195.248.251:80     is a NameVirtualHost
             default server www.djerk.nl (/etc/apache2/vhosts/Vhosts_ispconfig.conf:16)
             port 80 namevhost www.djerk.nl (/etc/apache2/vhosts/Vhosts_ispconfig.conf:16)
             port 80 namevhost www.geurtscass.com (/etc/apache2/vhosts/Vhosts_ispconfig.conf:69)
    wildcard NameVirtualHosts and _default_ servers:
    *:*                    is a NameVirtualHost
             default server localhost.localdomain (/etc/apache2/sites-enabled/000-default:2)
             port * namevhost localhost.localdomain (/etc/apache2/sites-enabled/000-default:2)
             port * namevhost localhost.localdomain (/etc/apache2/sites-enabled/web1.djerk.nl:1)
             port * namevhost www.geurtscass.com (/etc/apache2/sites-enabled/web2.geurtscass.com:1)
    Syntax OK
    Now how do I set the default server to a subdomain of the domain assigned to a vhost
     
    Last edited: Nov 6, 2005
  7. falko

    falko Super Moderator

    What's in /etc/apache2/sites-available/web1.djerk.nl?
     
  8. dmgeurts

    dmgeurts New Member

    Code:
    <VirtualHost *>
            ServerName [url]www.djerk.nl[/url]
            ServerAlias djerk.nl
            ServerAdmin [email]webmaster@djerk.nl[/email]
    
            DocumentRoot /var/www/web1/web
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </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/www/web1/log/apache2.error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/www/web1/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>
    I must admit, I noticed I'd uncommented the servername here. Reinstating it does not help but does change the following output slightly:

    Code:
    suzy:/etc/apache2# /usr/sbin/apache2 -S
    VirtualHost configuration:
    217.195.248.251:80     is a NameVirtualHost
             default server www.djerk.nl (/etc/apache2/vhosts/Vhosts_ispconfig.conf:16)
             port 80 namevhost www.djerk.nl (/etc/apache2/vhosts/Vhosts_ispconfig.conf:16)
             port 80 namevhost www.geurtscass.com (/etc/apache2/vhosts/Vhosts_ispconfig.conf:69)
    wildcard NameVirtualHosts and _default_ servers:
    *:*                    is a NameVirtualHost
             default server localhost.localdomain (/etc/apache2/sites-enabled/000-default:2)
             port * namevhost localhost.localdomain (/etc/apache2/sites-enabled/000-default:2)
             port * namevhost www.djerk.nl (/etc/apache2/sites-enabled/web1.djerk.nl:1)
             port * namevhost www.geurtscass.com (/etc/apache2/sites-enabled/web2.geurtscass.com:1)
    Syntax OK
    
     
    Last edited: Nov 6, 2005
  9. falko

    falko Super Moderator

    Can you change ServerName in /etc/apache2/sites-available/web1.djerk.nl to something that does not conflict with the web sites in ISPConfig (e.g. server.djerk.nl)? Don't forget to restart Apache.
     
  10. dmgeurts

    dmgeurts New Member

    The result is:
    Code:
    suzy:/etc/apache2# /usr/sbin/apache2 -S
    VirtualHost configuration:
    217.195.248.251:80     is a NameVirtualHost
             default server www.djerk.nl (/etc/apache2/vhosts/Vhosts_ispconfig.conf:16)
             port 80 namevhost www.djerk.nl (/etc/apache2/vhosts/Vhosts_ispconfig.conf:16)
             port 80 namevhost www.geurtscass.com (/etc/apache2/vhosts/Vhosts_ispconfig.conf:73)
    wildcard NameVirtualHosts and _default_ servers:
    *:*                    is a NameVirtualHost
             default server localhost.localdomain (/etc/apache2/sites-enabled/000-default:2)
             port * namevhost localhost.localdomain (/etc/apache2/sites-enabled/000-default:2)
             port * namevhost test.djerk.nl (/etc/apache2/sites-enabled/web1.djerk.nl:1)
             port * namevhost www.geurtscass.com (/etc/apache2/sites-enabled/web2.geurtscass.com:1)
    Syntax OK
    Browser test:
    www.djerk.nl - now gives an error (404) which is good as there's nothing to serve
    test.djerk.nl - behaves serves the info.php file as plain txt
     
  11. dmgeurts

    dmgeurts New Member

    http://httpd.apache.org/docs/2.0/vhosts/examples.html
    I somehow don't think this is why my server isn't serving PHP
     
  12. falko

    falko Super Moderator

    That's ok because PHP is globally disabled. ISPConfig enables it on a per-site basis. So if you create a web site for test.djerk.nl in ISPConfig and enable PHP, then PHP will work.
     
  13. dmgeurts

    dmgeurts New Member

    Then why doesn't it work for www.geurtscass.com (only available locally due to DNS migration)

    Right clearing a cache can be usefull. Creating test.djerk.nl and copying info.php it worked... I'd only turned PHP on nothing else.

    And now it works for www.djerk.nl and www.geurtscass.nl \o/

    Thanks falco. Not sure what really was wrong anymore now. Time to reread the thread. :)

    Sod it, removing the site test.djerk.nl breaks PHP again...

    Right... This explains a lot:
    Code:
    suzy:/etc/apache2# /usr/sbin/apache2 -S
    VirtualHost configuration:
    217.195.248.251:80     is a NameVirtualHost
             default server www.djerk.nl (/etc/apache2/vhosts/Vhosts_ispconfig.conf:17)
             port 80 namevhost www.djerk.nl (/etc/apache2/vhosts/Vhosts_ispconfig.conf:17)
             port 80 namevhost www.geurtscass.com (/etc/apache2/vhosts/Vhosts_ispconfig.conf:74)
    192.168.100.200:80     is a NameVirtualHost
             default server test.djerk.nl (/etc/apache2/vhosts/Vhosts_ispconfig.conf:131)
             port 80 namevhost test.djerk.nl (/etc/apache2/vhosts/Vhosts_ispconfig.conf:131)
    wildcard NameVirtualHosts and _default_ servers:
    *:*                    is a NameVirtualHost
             default server localhost.localdomain (/etc/apache2/sites-enabled/000-default:2)
             port * namevhost localhost.localdomain (/etc/apache2/sites-enabled/000-default:2)
             port * namevhost www.djerk.nl (/etc/apache2/sites-enabled/web1.djerk.nl:1)
             port * namevhost www.geurtscass.com (/etc/apache2/sites-enabled/web2.geurtscass.com:1)
    Syntax OK
    Being able to configure * instead of a specific IP address for a site could fix this. I've been told... Any objections to this, if not can it be added to ispconfig?
     
    Last edited: Nov 6, 2005
  14. falko

    falko Super Moderator

    Maybe you should also remove www.geurtscass.com from/etc/apache2/sites-available/web2.geurtscass.com.


    No, this isn't possible in ISPConfig.
     
  15. dmgeurts

    dmgeurts New Member

    I have ripped out my NAT config and routed the public IP, this simplifies things greatly and as the vhost is destination IP and domain name specific it was what ultimately gave me trouble. Good thing I found the other stuff which was wrong in the process.

    Thanks again all, and especially falko it's much appreciated that you spend you spare time helping ppl like me
     

Share This Page