Strange: domain/info.php OK, index.php NOT

I’ve never seen this one. Everything installed fine on my fresh OS server. Control panel works fine. Everything seems fine. Then I make an info.php file (<?php phpinfo() ?>), and it works fine. So I put my php app in the doc root (public_html) and it won’t load. I try info.php again, and it’s fine. Then I put a quick “testing” index.html file in public_html, and it won’t load unless I type out index.html.

So …
domain/index.html works
domain/info.php works
domain/ — nothing
domain/index.php — nothing

I’m stumped.

Can you share part of the Nginx configuration your site is using?
To be specific the location / {} block and location ~ [^/]\.php(/|$) {} block

Everything is set to default. I looked at Not work PHP code in HTML files - #4 by eris hoping to find some clue, but nothing.

Nginx Default Template @ /usr/local/hestia/data/templates/web/nginx/

	location / {
		proxy_pass http://%ip%:%web_port%;

		location ~* ^.+\.(%proxy_extensions%)$ {
			try_files  $uri @fallback;

			root       %docroot%;
			access_log /var/log/%web_system%/domains/%domain%.log combined;
			access_log /var/log/%web_system%/domains/%domain%.bytes bytes;

			expires    max;
		}

/usr/local/hestia/data/templates/web/nginx/php-fpm/

location / {
		location ~* ^.+\.(jpeg|jpg|png|webp|gif|bmp|ico|svg|css|js)$ {
			expires max;
			fastcgi_hide_header "Set-Cookie";
		}

		location ~ [^/]\.php(/|$) {
			try_files $uri =404;

			include /etc/nginx/fastcgi_params;

			fastcgi_index index.php;
			fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

			fastcgi_pass %backend_lsnr%;

			include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
		}

/usr/local/hestia/data/templates/web/apache2/php-fpm/default.tpl

<VirtualHost %ip%:%web_port%>

    ServerName %domain_idn%
    %alias_string%
    ServerAdmin %email%
    DocumentRoot %docroot%
    ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
    Alias /vstats/ %home%/%user%/web/%domain%/stats/
    Alias /error/ %home%/%user%/web/%domain%/document_errors/
    #SuexecUserGroup %user% %group%
    CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
    CustomLog /var/log/%web_system%/domains/%domain%.log combined
    ErrorLog /var/log/%web_system%/domains/%domain%.error.log

    IncludeOptional %home%/%user%/conf/web/%domain%/apache2.forcessl.conf*

    <Directory %home%/%user%/web/%domain%/stats>
        AllowOverride All
    </Directory>
    <Directory %docroot%>
        AllowOverride All
        Options +Includes -Indexes +ExecCGI
    </Directory>

    <FilesMatch \.php$>
        SetHandler "proxy:%backend_lsnr%|fcgi://localhost"
    </FilesMatch>

    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0

    IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.conf_*
    IncludeOptional /etc/apache2/conf.d/*.inc
</VirtualHost>

Not sure the exact file you wanted.

Oh I see you are using Nginx proxied to Apache, I all ever used full Nginx, I am afraid I won’t be able to help in this case :disappointed:

Could you please show the output of these commands?

Note: replace YourUser and YourDomain with the actual data.

grep -Ri directoryindex /etc/apache2
ls -la /home/YourUser/web/YourDomain/public_html/
cat /home/YourUser/web/YourDomain/public_html/.htaccess

I was able to get it working. I removed my web domain and added it back. I had to manually remove the folder for some reason (/home/user/web/domain). I still have no idea why this problem showed up or why it was fixed. I will see if it happens again with my other web domains, if so I’ll continue this thread.

Q: I found one issue with the Drupal install that can be fixed real easy, where can I post the fix?

1 Like

You can create a pull request on Github.

1 Like