Answer the question
In order to leave comments, you need to log in
How to make a normal 404 error?
There is nginx with the following configs:
server {
listen 80;
server_name bety.ml *.bety.ml;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl spdy;
server_name bety.ml *.bety.ml;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/nginx/ssl/bety.ml_bundle.crt;
ssl_certificate_key /etc/nginx/ssl/bety.ml.key;
ssl_trusted_certificate /etc/nginx/ssl/ca-certs.pem;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
ssl_ciphers kEECDH+AES128:kEECDH:kEDH:-3DES:kRSA+AES128:kEDH+3DES:DES-CBC3-SHA:!RC4:!aNULL:!eNULL:!MD5:!EXPORT:!LOW:!SEED:!CAMELLIA:!IDEA:!PSK:!SRP:!SSLv2;
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 5s;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
add_header Content-Security-Policy-Report-Only "default-src https:; script-src https: 'unsafe-eval' 'unsafe-inline'; style-src https: 'unsafe-inline'; img-src https: data:; font-src https: data:; report-uri /csp-report";
root /var/bety/$subdomain;
index index.php;
set $subdomain "";
if ($host ~* ^([a-z0-9-\.]+)\.bety.ml$)
{
set $subdomain $1;
}
if ($subdomain = "www")
{
return 301 $scheme://bety.ml$request_uri;
}
if ($subdomain = "")
{
set $subdomain "www";
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location /
{
try_files $uri $uri/ /index.php;
}
location ~ \.php$
{
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Answer the question
In order to leave comments, you need to log in
location /
{
index index.php;
}
So in your config it says so if there is no file then go to the php index
try_files $uri $uri/ /index.php;
It is logical to pass all the parameters to it depending on the cms
For wordpress, let's say
try_files $uri $uri/ /index.php?q=$uri&$args;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question