I have two problems : Upgrading mysql and configurating my custom
404.html page.
I wanted to install an admin page, but need to the consistency of mysql
and php version, so I wanted upgrade mysql as the same version as PHP,
and I had the following result:
Nginx failure and impossible to use port 81. My website stop to work.
I set Nginx on port 81 because I could not connect my VPS on Internet
for updating and installing packages.
Here is my configuration :
Debian 6 wheezy (ok)
nginx (ok)
php5 (cgi and fmp not installed)
mysql (ok)
csf firewall (ok)
naxsi (installed but not working)
So I spent days on google without finding solutions, knowing I had
previously installed csf firewall, Meanwhile I wanted to change the
default nginx 404 page to my custom 404.html page, my errors html files
are in the root directory, that I had configure this default server
file, but still does not work, and then I can’t stop nginx ( “nginx stop
service.” ) The nginx.pid is missing.
My website works and mysql too, but I’m stuck here.
Can you give me the solution ?
Any help will be appreciated.
Thank you.
-nginx.conf
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json
application/x-javascript
text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
include /etc/nginx/naxsi_core.rules;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
My default server conf file :
server {
listen 81; ## listen for ipv4; this line is default and
implied
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /var/www/;
index index.html index.htm index.php
error_page 404 /404.html;
location = /40x.html {
root /var/www/;
internal;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/;
}
#Make site accessible from http://www.site.com/
server_name site.com www.site.com;
access_log /var/log/nginx/site.access.log;
error_log /var/log/nginx/site.error.log;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
include /etc/nginx/naxsi.rules;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
# Only for nginx-naxsi used with nginx-naxsi-ui : process denied
requests
location /RequestDenied {
proxy_pass http://127.0.0.1:8081;
return 500;
}
# pass the PHP scripts to FastCGI server listening on
127.0.0.1:9000
#
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
# # NOTE: You should have “cgi.fix_pathinfo = 0;” in
php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
root@xxx:~# netstat -ntpul
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address
State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:*
LISTEN 2989/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:*
LISTEN 3198/sshd
tcp 0 0 0.0.0.0:81 0.0.0.0:*
LISTEN 4647/nginx
tcp 0 0 127.0.0.1:6010 0.0.0.0:*
LISTEN 18881/0
tcp6 0 0 :::22 :::*
LISTEN 3198/sshd
tcp6 0 0 :::80 :::*
LISTEN 2266/apache2
tcp6 0 0 ::1:6010 :::*
LISTEN 18881/0
udp 0 0 0.0.0.0:36913 0.0.0.0:*
2299/avahi-daemon:
udp 0 0 xx.xx.x.xx:xxx 0.0.0.0:*
3139/ntpd
udp 0 0 xxx.xx.xxx.xxx:xxx 0.0.0.0:*
3139/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:*
3139/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:*
3139/ntpd
udp 0 0 0.0.0.0:5353 0.0.0.0:*
2299/avahi-daemon:
udp 0 0 0.0.0.0:1900 0.0.0.0:*
3303/minissdpd
udp6 0 0 :::49180 :::*
2299/avahi-daemon:
udp6 0 0 ::1:123 :::*
3139/ntpd
udp6 0 0 xx80::xxxx:xx:xxx::xxx :::*
3139/ntpd
udp6 0 0 :::123 :::*
3139/ntpd
udp6 0 0 :::5353 :::*
2299/avahi-daemon: