Problem vhost file Apache with ISPConfig

Discussion in 'Installation/Configuration' started by gillesdevals, May 12, 2022.

  1. gillesdevals

    gillesdevals Member

    Hello,


    I installed ISPConfig 3.2.8p1 on Ubuntu 20.04.4 LTS on a VPS by using https://www.howtoforge.com/ispconfig-autoinstall-debian-ubuntu/
    The ISPConfig panel works correctly.

    When i create a website, for example nicoledevals.ch it seems the vhost file created by ISPConfig has a problem.
    If I go to the site I have the default apache page.

    In /etc/apache2/sites-available/ I have two fils :
    nicoledevals.ch.vhost
    Code:
     # Apache did not start after modifying this vhost file.
    # Please check file /etc/apache2/sites-available/nicoledevals.ch.vhost.err for syntax errors.
    nicoledevals.ch.vhost.err
    Code:
    <Directory /var/www/nicoledevals.ch>
                    AllowOverride None
                                    Require all denied
                    </Directory>
    
    <VirtualHost *:80>
    
    
                                                                            DocumentRoot /var/www/nicoledevals.ch/web
    
                    ServerName nicoledevals.ch
                    ServerAlias *.nicoledevals.ch
                    ServerAdmin [email protected]
    
    
                    ErrorLog /var/log/ispconfig/httpd/nicoledevals.ch/error.log
    
                    Alias /error/ "/var/www/nicoledevals.ch/web/error/"
                    ErrorDocument 400 /error/400.html
                    ErrorDocument 401 /error/401.html
                    ErrorDocument 403 /error/403.html
                    ErrorDocument 404 /error/404.html
                    ErrorDocument 405 /error/405.html
                    ErrorDocument 500 /error/500.html
                    ErrorDocument 502 /error/502.html
                    ErrorDocument 503 /error/503.html
    
    
                    <Directory /var/www/nicoledevals.ch/web>
                                    # Clear PHP settings of this website
                                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                                                    SetHandler None
                                    </FilesMatch>
                                    Options +SymlinksIfOwnerMatch
                                    AllowOverride All
                                                                    Require all granted
    
                                    # ssi enabled
                                    AddType text/html .shtml
                                    AddOutputFilter INCLUDES .shtml
                                    Options +Includes
                    </Directory>
                    <Directory /var/www/clients/client0/web4/web>
                                    # Clear PHP settings of this website
                                    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
                                                    SetHandler None
                                    </FilesMatch>
                                    Options +SymlinksIfOwnerMatch
                                    AllowOverride All
                                                                    Require all granted
    
                                    # ssi enabled
                                    AddType text/html .shtml
                                    AddOutputFilter INCLUDES .shtml
                                    Options +Includes
                    </Directory>
                    <IfModule mod_perl.c>
                            PerlModule ModPerl::Registry
                            PerlModule Apache2::Reload
                            <Directory /var/www/nicoledevals.ch/web>
                                    PerlResponseHandler ModPerl::Registry
                                    PerlOptions +ParseHeaders
                                    Options +ExecCGI
                            </Directory>
                            <Directory /var/www/clients/client0/web4/web>
                                    PerlResponseHandler ModPerl::Registry
                                    PerlOptions +ParseHeaders
                                    Options +ExecCGI
                            </Directory>
                <Files *.pl>
                                    SetHandler perl-script
                </Files>
                    </IfModule>
    
    
                    # cgi enabled
            <Directory /var/www/clients/client0/web4/cgi-bin>
                            AllowOverride All
                                                    Require all granted
                                            </Directory>
                    ScriptAlias  /cgi-bin/ /var/www/clients/client0/web4/cgi-bin/
                    <FilesMatch "\.(cgi|pl)$">
                            SetHandler cgi-script
                    </FilesMatch>
                    # suexec enabled
                    <IfModule mod_suexec.c>
                            SuexecUserGroup web4 client0
                    </IfModule>
                    # mod_php enabled
                    AddType application/x-httpd-php .php .php3 .php4 .php5
                    SetEnv TMP /var/www/clients/client0/web4/tmp
                    SetEnv TMPDIR /var/www/clients/client0/web4/tmp
                    SetEnv TEMP /var/www/clients/client0/web4/tmp
                                    php_admin_value sendmail_path "/usr/sbin/sendmail -t -i [email protected]"
                                    php_admin_value upload_tmp_dir /var/www/clients/client0/web4/tmp
                    php_admin_value session.save_path /var/www/clients/client0/web4/tmp
            # PHPIniDir /var/www/conf/web4
                    php_admin_value open_basedir /var/www/clients/client0/web4/web:/var/www/clients/client0/web4/private:/var/www/clients/client0/web4/tmp:/var/www/nicoledevals.ch/web:/srv/www/nicoledevals.ch/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom
    
    
    
                    # add support for apache mpm_itk
                    <IfModule mpm_itk_module>
                            AssignUserId web4 client0
                    </IfModule>
    
                    <IfModule mod_dav_fs.c>
                    # Do not execute PHP files in webdav directory
                            <Directory /var/www/clients/client0/web4/webdav>
                                    <ifModule mod_security2.c>
                                            SecRuleRemoveById 960015
                                            SecRuleRemoveById 960032
                                    </ifModule>
                                    <FilesMatch "\.ph(p3?|tml)$">
                                            SetHandler None
                                    </FilesMatch>
                            </Directory>
                            DavLockDB /var/www/clients/client0/web4/tmp/DavLock
                            # DO NOT REMOVE THE COMMENTS!
                            # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
          # WEBDAV BEGIN
                            # WEBDAV END
                    </IfModule>
    
    
    
    
    </VirtualHost>
    How can I resolve this problem ?


    Thanks in advance
     
    Last edited: May 12, 2022
  2. michelangelo

    michelangelo Active Member

    You may want to check this line:

    Code:
      DocumentRoot /var/www/nicoledevals.ch/w>
     
  3. gillesdevals

    gillesdevals Member

    Sorry, it's corrected in the first message.
    copy/paste from Nano ;-)

    Code:
      DocumentRoot /var/www/nicoledevals.ch/web
    [/QUOTE]

    Do you have an idea where is the problem ?
     
  4. michelangelo

    michelangelo Active Member

    Okay, that explains it. Thought you tried to overwrite the DocumentRoot via the Apache Directives in ISPConfig and accidently had a typo in the path.
    While looking at the conf file I don't spot ad hoc anything severe but is there a reason why you use mod_php instead of php-fpm? If I recall correctly then newer HTTPD 2.4 mpm configurations are not set to prefork mode as default anymore, so mod_php shouldn't work by default unless it was at some point correctly configured to run this way.

    Also have a look at the vhost error_log and the general error_log of the httpd daemon, but I think the reason for the error is most likely mod_php. Switch to a php-fpm setup and it should work and if not have a look into the error_logs.
     
  5. gillesdevals

    gillesdevals Member

    It's work correctly now.

    I was using mod-php for a very long time, out of habit.

    Thank you very very much,
     

Share This Page