Answer the question
In order to leave comments, you need to log in
How to properly configure Nginx in Ubuntu 16 to work with phpmyadmin?
Hello, I'm new to linux and need help.
Here I made a config for Nginx, on the server there are several domains with subdomains.
/etc/nginx/sites-available/mydomain.ru
server {
listen 80 ;
listen [::]:80 ;
root /var/www/mydomaine.ru;
index index.html;
server_name mydomaine.ru;
location / {
try_files $uri $uri/ @rewrites;
}
location @rewrites {
rewrite ^(.+)$ /index.html last;
}
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
# Some basic cache-control for static files to be sent to the browser
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
}
server {
listen 80;
listen [::]:80;
root /var/www/login.mydomaine.ru;
index index.php index.html;
server_name login.mydomaine.ru login.www.mydomaine.ru;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass 127.0.0.1:9000;
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 /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
}
502 Bad Gateway
nginx/1.10.3 (Ubuntu)
2018/03/21 10:45:49 [error] 26433#26433: *22 open() "/var/www/login.mydomaine.ru/favicon.ico" failed (2: No such file or directory), client: 50.40.30.20, server: login.mydomaine.ru, request: "GET /favicon.ico HTTP/1.1", host: "login.mydomaine.ru", referrer: "http://login.mydomaine.ru/phpmyadmin/"
2018/03/21 10:45:49 [error] 26433#26433: *22 connect() failed (111: Connection refused) while connecting to upstream, client: 50.40.30.20, server: login.mydomaine.ru, request: "GET /phpmyadmin/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "login.mydomaine.ru"
2018/03/21 10:45:50 [error] 26433#26433: *22 open() "/var/www/login.mydomaine.ru/favicon.ico" failed (2: No such file or directory), client: 50.40.30.20, server: login.mydomaine.ru, request: "GET /favicon.ico HTTP/1.1", host: "login.mydomaine.ru", referrer: "http://login.mydomaine.ru/phpmyadmin/"
2018/03/21 10:45:52 [error] 26433#26433: *22 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined variable: Error in /var/www/login.mydomaine.ru/template/admin/login_form.php on line 5" while reading response header from upstream, client: 50.40.30.20, server: login.mydomaine.ru, request: "GET /admin.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "login.mydomaine.ru"
2018/03/21 10:45:53 [error] 26433#26433: *22 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined variable: Error in /var/www/login.mydomaine.ru/template/admin/login_form.php on line 5" while reading response header from upstream, client: 50.40.30.20, server: login.mydomaine.ru, request: "GET /admin.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "login.mydomaine.ru"
2018/03/21 10:45:53 [error] 26433#26433: *26 open() "/var/www/login.mydomaine.ru/favicon.ico" failed (2: No such file or directory), client: 50.40.30.20, server: login.mydomaine.ru, request: "GET /favicon.ico HTTP/1.1", host: "login.mydomaine.ru", referrer: "http://login.mydomaine.ru/admin.php"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question