1

I switched to NGINX a couple of days ago and I just started to upload my webpages again. Almost everything seems to be working fine execpt for some subdirectories. I have a forum page and when I try to goto that page it gives me an error message with "HTTP ERROR 500" I just copied all the files I previously used with apache to the new folder.

Noticed with /forum that it gives "HTTP ERROR 500" And with /img a FORBIDDEN error but this could be something else.

Current config in sites-available I do have pterodactyl panel installed in a different config file but I dont think it matters.


server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html index.php;

        server_name ****.com www.****.com localhost;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                #try_files $uri $uri/ =404;
                try_files $uri/ $uri /index.php?$query_string;
        }
location /phpmyadmin {
 auth_basic "Admin Login";
 auth_basic_user_file /etc/nginx/pma_pass;
 root /usr/share/;
 index index.php index.html index.htm;
 location ~ ^/phpmyadmin/(.+\.php)$ {
 try_files $uri =404;
 fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
 include fastcgi_params;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

}
 location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
 root /usr/share/;
 }
 }

        location ~ \.php$ {
               # try_files $uri =404;

                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                include snippets/fastcgi-php.conf;
        #        include fastcgi_params;
        #        fastcgi_index index.php;

        #       # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}


2
  • 1
    May be a permission issue? Check directory and files permissions in the problematic paths.
    – simlev
    Commented May 15, 2019 at 13:09
  • 2
    I think i solved it, when going to /img there is no index page so it will try to show all the files in that directory but this was not allowed.
    – tom keuper
    Commented May 16, 2019 at 14:27

1 Answer 1

1

Problem solved nginx was trying to give an index of the page but was not allowed to. edited default in sites-available/ and now its working.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .