Hello,
I am starting to try nginx.
To begin i would like to install phpmyadmin, i think it a good exercise.
** Information
- my server uses ubuntu 14.04
- my server has got an IPv6 only
- the url to access to phpmyadmin will be : phpmyadmin.soapoperator.com
***Configuration:
Public html folder:
root@server01:/usr/share/nginx/html# ls -l
total 12
-rw-r--r-- 1 root root 537 Mar 4 2014 50x.html
-rw-r--r-- 1 root root 612 Mar 4 2014 index.html
-rw-r--r-- 1 root root 20 Jan 1 13:21 info.php
lrwxrwxrwx 1 root root 21 Dec 31 18:41 phpmyadmin -> /usr/share/phpmyadmin
Config into sites available:
root@server01:/etc/nginx/sites-available# ls -l
total 8
-rw-r--r-- 1 root root 833 Jan 1 14:19 phpmyadmin.soapoperator.com
-rw-r--r-- 1 root root 2603 Jan 1 13:35 default
Config for the host
server {
listen 80;
#listen [::]:80 ipv6only=on;
server_name phpmyadmin.soapoperator.com;
root /usr/share/nginx/html/phpmyadmin;
index index.php index.html index.htm;
# allow
#allow 82.230.xx.x;
#allow 2a01:e35:2e65:3070:xxx:xxx:c95c:69a;
# drop rest of the world
#deny all;
# Logs
access_log /var/log/phpmyadmin.access_log;
error_log /var/log/phpmyadmin.error_log;
# Default location settings
location / {
charset utf-8;
client_max_body_size 20M;
}
location ~* \.php$ {
# Prevent Zero-day exploit
try_files $uri =404;
# Pass the PHP scripts to FastCGI server
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_param HTTPS off;
}
}
I enabled the site:
root@server01:/etc/nginx/sites-enabled# ls -l
total 0
lrwxrwxrwx 1 root root 46 Jan 1 13:54 phpmyadmin.soapoperator.com -> /etc/nginx/sites-available/phpmyadmin.soapoperator.com
lrwxrwxrwx 1 root root 34 Dec 31 14:28 default -> /etc/nginx/sites-available/default
Unfortunately when i visit the phpmyadmin url, i arrive on the nginx welcome page.
So i guess the vhost is not well configured. But why?
I wondering if it was not an issue due to the ipv6 configuration.
Or a php issue because when i try to visit http://[my_ip]/info.php, the file is serving as download instead of excecuting.
Thank you in advance for any help.
jb
I am starting to try nginx.
To begin i would like to install phpmyadmin, i think it a good exercise.
** Information
- my server uses ubuntu 14.04
- my server has got an IPv6 only
- the url to access to phpmyadmin will be : phpmyadmin.soapoperator.com
***Configuration:
Public html folder:
root@server01:/usr/share/nginx/html# ls -l
total 12
-rw-r--r-- 1 root root 537 Mar 4 2014 50x.html
-rw-r--r-- 1 root root 612 Mar 4 2014 index.html
-rw-r--r-- 1 root root 20 Jan 1 13:21 info.php
lrwxrwxrwx 1 root root 21 Dec 31 18:41 phpmyadmin -> /usr/share/phpmyadmin
Config into sites available:
root@server01:/etc/nginx/sites-available# ls -l
total 8
-rw-r--r-- 1 root root 833 Jan 1 14:19 phpmyadmin.soapoperator.com
-rw-r--r-- 1 root root 2603 Jan 1 13:35 default
Config for the host
server {
listen 80;
#listen [::]:80 ipv6only=on;
server_name phpmyadmin.soapoperator.com;
root /usr/share/nginx/html/phpmyadmin;
index index.php index.html index.htm;
# allow
#allow 82.230.xx.x;
#allow 2a01:e35:2e65:3070:xxx:xxx:c95c:69a;
# drop rest of the world
#deny all;
# Logs
access_log /var/log/phpmyadmin.access_log;
error_log /var/log/phpmyadmin.error_log;
# Default location settings
location / {
charset utf-8;
client_max_body_size 20M;
}
location ~* \.php$ {
# Prevent Zero-day exploit
try_files $uri =404;
# Pass the PHP scripts to FastCGI server
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_param HTTPS off;
}
}
I enabled the site:
root@server01:/etc/nginx/sites-enabled# ls -l
total 0
lrwxrwxrwx 1 root root 46 Jan 1 13:54 phpmyadmin.soapoperator.com -> /etc/nginx/sites-available/phpmyadmin.soapoperator.com
lrwxrwxrwx 1 root root 34 Dec 31 14:28 default -> /etc/nginx/sites-available/default
Unfortunately when i visit the phpmyadmin url, i arrive on the nginx welcome page.
So i guess the vhost is not well configured. But why?
I wondering if it was not an issue due to the ipv6 configuration.
Or a php issue because when i try to visit http://[my_ip]/info.php, the file is serving as download instead of excecuting.
Thank you in advance for any help.
jb