搜尋

首頁  >  問答  >  主體

mac本地基於nginx搭建wordPress的一些問題

nginx是用brew安裝的,nginx version: nginx/1.10.2

wordpress 也是最新版,是在官網下載的tar包解壓縮的

在nginx的server資料夾下設定好root、index檔案之後,透過瀏覽器存取wordpress的wp-admin/install.php,

接著出現了奇葩的問題,造訪的結果不是正常開啟網頁,而是將install.php檔案重新下載了一遍! ! ! !
求教是可能的那個地方有問題。
主要是沒有報錯,也不知道如何下手去搜尋這種情況,於是來提問了,謝謝!

nginx.conf 配置(是預設的沒有修改過)

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


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

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       8080;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    include servers/*;
}

我額外設定的word_press.conf

#
server {
    listen 8081;
    server_name console.word-press.local; #绑定域名

    location ~ \.php$ {
        root /Users/lights/easyops/wordpress; #网站根目录
        index index.php index.html index.htm; #默认文件
        # root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        include        fastcgi_params;
    }
}
伊谢尔伦伊谢尔伦2754 天前476

全部回覆(2)我來回復

  • 仅有的幸福

    仅有的幸福2017-05-16 17:12:46

    請貼一下你的nginx相關server配置的內容

    這個問題要不是php-fpm沒有設置,就是try_files設定錯誤

    回覆
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 17:12:46

    你的PHP在Nginx裡配置有問題,也就是說你本地的WEB伺服器環境配置沒有配置好,Nginx根本就無法解析.php檔!
    建議你搭建好Mac本地的Web環境後再安裝 WordPress !

    回覆
    0
  • 取消回覆