1

I made an app with laravel and nuxt. I deployed it to server with nginx. My nginx code is like this

server {
        listen 80;
        root /home/anjaan/desijewel/api/public;  
        index index.php index.html index.htm index.nginx-debian.html;
        server_name 206.189.142.151;

        location /api {
                       try_files $uri $uri/ /index.php?$query_string;
         }

        location / {
         // Reverse proxy code from nuxtjs.org
        }


        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        }

       location ~ /\.(?!well-known).* {
        deny all;
       }
        location /phpmyadmin {
        alias /home/anjaan/desijewel/;
        index index.php;}}

I linked phpmyadmin to /home/anjaan/desijewel. But now it showing 403 error.

It works fine when I link this to /api/public(Laravel Folder). And nginx error log showing -

access forbidden by rule, client: 1.39.244.47, server: 206.189.142.151, request: "GET /jyoteshdb/ HTTP/1.1", host: "206.189.142.151"
mukeshsoni
  • 483
  • 8
  • 29
  • Try [this](https://stackoverflow.com/a/62362487/7121513) answer. Replace socket path with yours `unix:/var/run/php/php7.4-fpm.sock` and if it won't work, replace `include fastcgi.conf;` with `include fastcgi_params;` – Ivan Shatsky Sep 08 '21 at 15:12

1 Answers1

1

Why are you trying to cram it all into one config?

Create a separate one for the Phpmyadmin server_name that's attached to phpmyadmin.test or something. So Nginx can serve Phpmyadmin from that URL.

Right now, it could be a number of issues that are hard to debug. If you separate everything, it's much easier to manage.

If you insist on having one single file. Check your nginx logs for errors. /var/log/nginx/error.log

Stan Smulders
  • 6,079
  • 1
  • 27
  • 23