Nginx – phpmyadmin configuration as location next to a website
To start, install phpmyadmin at the desired location.
compose create-project phpmyadmin/phpmyadmin
I prefer to use composer, but there are other possibilities
Once this is done go in the folder /etc/nginx.
To keep the configuration independent, it is possible to create a snippets.
sudo nano snippets/phpmyadmin.conf
Then the next configuration must be created, in this example phpmyadmin is installed under /www
location /phpmyadmin { root /www/; index index.php index.html index.htm; location ~ ^/phpmyadmin/(.+\.php)$ { try_files $uri =404; root /www/; fastcgi_pass unix:/run/php/php7.3-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /www/; } }
Publicités
The configuration of the website must be open edit and a line in the server block allows you to add the snippet: include snippets/phpmyadmin.conf;
server listen 80; server_name website.local; include snippets/phpmyadmin.conf; }
And simply restart services
sudo service nginx restart && sudo service php7.3-fpm restart
Publicités