无论我做何配置,我的服务器都只会返回 404 错误。
文件/etc/nginx/sites-available/name.net
:
server {
listen 80;
listen [::]:80;
root /home/name/public_html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name domain.net www.domain.net;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
#modificacao Danilo
location ~ \.php$ {
#try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_cache microcache;
fastcgi_cache_key $scheme$host$request_uri$request_method;
fastcgi_cache_valid 200 301 302 30s;
fastcgi_cache_use_stale updating error timeout invalid_header http_500;
fastcgi_pass_header Set-Cookie;
fastcgi_pass_header Cookie;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
#modificacao Danilo
location ~* \.(woff|eot|ttf|svg|mp4|webm|jpg|jpeg|png|gif|ico|css|js)$ {
access_log off;
log_not_found off;
expires 12d;
}
#Danilo semCache
set $no_cache "";
if ($request_method = POST)
{
set $no_cache 1;
}
if ($request_uri ~* "/(wp-admin/|wp-login.php)")
{
set $no_cache 1;
}
if ($http_cookie ~* "wordpress_logged_in_")
{
set $no_cache 1;
}
#location ~ /(wp-config.php|readme.html|licence.txt) {
# return 404;
#}
#if ($request_method !~ ^(GET|POST|HEAD)$ ) {
# return 444;
#}
}
ls -la /home/name.net/public_html/
: