在Nginx上安装WordPress-Nginx发送install.php

前端之家收集整理的这篇文章主要介绍了在Nginx上安装WordPress-Nginx发送install.php 前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我正在尝试将Nginx配置为提供wordpress安装(和Rails应用-但这不是问题).

我有一个奇怪的问题:我设法使PHP正常工作(正确解析了基本的test.PHP),但是当我想安装wordpress时,Nginx会向我发送install.PHP文件-我可以下载它.

这是Nginx唯一可以做到这一点的文件:其他wordpress文件得到了很好的服务,并且确实重定向到install.PHP了很多时间.

我在Gentoo上.
我使用spawn-fcgi,在我的Nginx.conf下面.有关的部分是第二台服务器(wp.domain.local):

    user Nginx Nginx;
    worker_processes 1;

    error_log /var/log/Nginx/error_log info;

    events {
        worker_connections 1024;
        use epoll;
    }

    http {
        include /etc/Nginx/mime.types;
        default_type application/octet-stream;

        log_format main
            '$remote_addr - $remote_user [$time_local] '
            '"$request" $status $bytes_sent '
            '"$http_referer" "$http_user_agent" '
            '"$gzip_ratio"';

        client_header_timeout 10m;
        client_body_timeout 10m;
        send_timeout 10m;

        connection_pool_size 256;
        client_header_buffer_size 1k;
        large_client_header_buffers 4 2k;
        request_pool_size 4k;

        gzip on;
        gzip_min_length 1100;
        gzip_buffers 4 8k;
        gzip_types text/plain;

        output_buffers 1 32k;
        postpone_output 1460;

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;

        keepalive_timeout 75 20;

        ignore_invalid_headers on;

        index index.html;

        upstream rails_app {
            server unix:/tmp/.sock fail_timeout=0;
        }

        server {
            server_name domain.local www.domain.local;

            access_log /var/log/Nginx/domain.local.access_log main;
            error_log /var/log/Nginx/domain.local.error_log info;

            root /path/to/rails/app/public;

            try_files $uri/index.html $uri.html $uri @app;

            location @app {
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_redirect off;
                proxy_pass http://rails_app;
            }

            # Rails error pages
            error_page 500 502 503 504 /500.html;
            location = /500.html {
                root /path/to/rails/app/public;
            }
        }

        server {
            server_name wp.domain.local *.wp.domain.local;

            access_log /var/log/Nginx/wp.domain.local.access_log main;
            error_log /var/log/Nginx/wp.domain.local.error_log info;

            root /path/to/wordpress;

            try_files $uri $uri/ /index.PHP;

            index index.PHP index.html index.htm default.html default.htm;
            location ~ \.PHP${
                include /etc/Nginx/fastcgi.conf;
                fastcgi_pass  127.0.0.1:65532;
                fastcgi_index index.PHP;
            }
        }

        server {
            server_name localhost www.localhost;

            access_log /var/log/Nginx/localhost.access_log main;
            error_log /var/log/Nginx/localhost.error_log info;

            root /var/www/localhost/htdocs;

            index index.PHP index.html index.htm default.html default.htm;
            location ~ \.PHP${
                include /etc/Nginx/fastcgi.conf;
                fastcgi_pass  127.0.0.1:65532;
                fastcgi_index index.PHP;
            }
        }

    }
最佳答案
尝试将try_files指令更改为try_files $uri $uri / /index.PHP?$args;处理wordpress使用的查询字符串.
原文链接:https://www.f2er.com/nginx/532210.html

猜你在找的Nginx相关文章