mukeshsoni
mukeshsoni

Reputation: 583

Set Phpmyadmin with Nuxt and Laravel in Nginx

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"

Upvotes: 1

Views: 187

Answers (1)

Stan Smulders
Stan Smulders

Reputation: 6237

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

Upvotes: 1

Related Questions