简单的Wordpress配置不重定向到根

时间:2014-05-19 21:25:36

标签: wordpress nginx

我在这里使用非常简单的nginx样板,但是当我尝试访问域名的根目录时,我的服务器似乎没有收听。这是我的nginx.conf

user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    gzip on;
    gzip_disable "msie6";

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

    server {
        listen 80;
        server_name blog.dev.company.com ;
        root /var/www/wordpress/ ;

        location / {
            index index.php index.html index.htm;
            try_files $uri $uri/ /index.php?$args;
        }
    }
}

根据我的理解,当我向blog.dev.company.com发出请求时,我应该得到我在/ var / www / wordpress中设置的index.php。相反,该网站只是挂起。找到域名,但nginx不处理请求。 nginx访问日志为空。我错过了什么?

1 个答案:

答案 0 :(得分:0)

你有这样的location来处理PHP脚本吗?

# Pass the PHP scripts to FastCGI server
location ~ \.php$ {
    try_files       $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    include         fastcgi_params;

    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass    unix:/var/run/php5-fpm.sock;   
}