ethanlau 发表于 2020-4-6 23:21:21

[求助]lnmp搭建wordpress的问题,大佬帮忙看看.

小白一个,按照教程安装了一键包,1.6版本,
安装完之后搭建WordPress,
诡异的地方来了,HTTPS+域名,可以访问,直接IP也可以访问,但是http+域名访问不了,
ping ip, ping 域名都通...


这是 nginx.conf 配置文件
userwww www;

worker_processes auto;
worker_cpu_affinity auto;

error_log/home/wwwlogs/nginx_error.logdebug;

pid      /usr/local/nginx/logs/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;

events
    {
      use epoll;
      worker_connections 51200;
      multi_accept off;
      accept_mutex off;
    }

http
    {
      include       mime.types;
      default_typeapplication/octet-stream;

      server_names_hash_bucket_size 128;
      client_header_buffer_size 32k;
      large_client_header_buffers 4 32k;
      client_max_body_size 50m;

      sendfile on;
      sendfile_max_chunk 512k;
      tcp_nopush on;

      keepalive_timeout 60;

      tcp_nodelay on;

      fastcgi_connect_timeout 300;
      fastcgi_send_timeout 300;
      fastcgi_read_timeout 300;
      fastcgi_buffer_size 64k;
      fastcgi_buffers 4 64k;
      fastcgi_busy_buffers_size 128k;
      fastcgi_temp_file_write_size 256k;

      gzip on;
      gzip_min_length1k;
      gzip_buffers   4 16k;
      gzip_http_version 1.1;
      gzip_comp_level 2;
      gzip_types   text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
      gzip_vary on;
      gzip_proxied   expired no-cache no-store private auth;
      gzip_disable   "MSIE \.";

      #limit_conn_zone $binary_remote_addr zone=perip:10m;
      ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.

      server_tokens off;
      access_log off;

include vhost/*.conf;
}


这是 vhost目录下的 配置文件内容
server
    {
      listen 80;
      #listen [::]:80;
      server_name 19kkk.com www.19kkk.com;
      index index.html index.htm index.php default.html default.htm default.php;
      root/home/wwwroot/19kkk.com;

      include rewrite/wordpress.conf;
      #error_page   404   /404.html;

      # Deny access to PHP files in specific directory
      #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

      include enable-php-pathinfo.conf;

      location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
      {
            expires      30d;
      }

      location ~ .*\.(js|css)?$
      {
            expires      12h;
      }

      location ~ /.well-known {
            allow all;
      }

      location ~ /\.
      {
            deny all;
      }

      access_log/home/wwwlogs/19kkk.com.log;
    }

server
    {
      listen 443 ssl http2;
      #listen [::]:443 ssl http2;
      server_name 19kkk.com www.19kkk.com;
      index index.html index.htm index.php default.html default.htm default.php;
      root/home/wwwroot/19kkk.com;

      ssl_certificate /usr/local/nginx/conf/ssl/19kkk.com/fullchain.cer;
      ssl_certificate_key /usr/local/nginx/conf/ssl/19kkk.com/19kkk.com.key;
      ssl_session_timeout 5m;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
      ssl_prefer_server_ciphers on;
      ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
      ssl_session_cache builtin:1000 shared:SSL:10m;
      # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
      ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;

      include rewrite/wordpress.conf;
      #error_page   404   /404.html;

      # Deny access to PHP files in specific directory
      #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

      include enable-php-pathinfo.conf;

      location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
      {
            expires      30d;
      }

      location ~ .*\.(js|css)?$
      {
            expires      12h;
      }

      location ~ /.well-known {
            allow all;
      }

      location ~ /\.
      {
            deny all;
      }

      access_log/home/wwwlogs/19kkk.com.log;
    }

这是 enable-php-pathinfo.conf 配置文件
      location ~ [^/]\.php(/|$)
      {
            fastcgi_passunix:/tmp/php-cgi.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
            include pathinfo.conf;
      }


这是 wordpress 的 rewrite配置文件
location / {
        try_files $uri $uri/ /index.php?$args;
}

# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;

这是 error 日志信息,我看上去觉得客户端在请求两次之后就断开链接了,然后报了104,不太明白咋回事.
2020/04/06 23:17:12 9287#0: *98 "/wp-admin$" does not match "/", client: 36.148.77.36, server: 19kkk.com, request: "GET / HTTP/1.1", host: "www.19kkk.com"
2020/04/06 23:17:12 9287#0: *98 "/wp-admin$" does not match "/index.php", client: 36.148.77.36, server: 19kkk.com, request: "GET / HTTP/1.1", host: "www.19kkk.com"
2020/04/06 23:17:12 9287#0: *98 epoll_wait() reported that client prematurely closed connection, so upstream connection is closed too (104: Connection reset by peer) while sending request to upstream, client: 36.148.77.36, server: 19kkk.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "www.19kkk.com"
2020/04/06 23:17:13 9286#0: *99 "/wp-admin$" does not match "/", client: 36.148.77.36, server: 19kkk.com, request: "GET / HTTP/1.1", host: "www.19kkk.com"
2020/04/06 23:17:13 9286#0: *99 "/wp-admin$" does not match "/index.php", client: 36.148.77.36, server: 19kkk.com, request: "GET / HTTP/1.1", host: "www.19kkk.com"
2020/04/06 23:17:13 9286#0: *99 client 36.148.77.36 closed keepalive connection (104: Connection reset by peer)
2020/04/06 23:17:13 9287#0: *102 recv() failed (104: Connection reset by peer) while waiting for request, client: 36.148.77.36, server: 0.0.0.0:80
2020/04/06 23:17:13 9287#0: *103 "/wp-admin$" does not match "/wp-admin/setup-config.php", client: 36.148.77.36, server: 19kkk.com, request: "GET /wp-admin/setup-config.php HTTP/1.1", host: "www.19kkk.com"
2020/04/06 23:17:13 9287#0: *103 epoll_wait() reported that client prematurely closed connection, so upstream connection is closed too (104: Connection reset by peer) while sending request to upstream, client: 36.148.77.36, server: 19kkk.com, request: "GET /wp-admin/setup-config.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "www.19kkk.com"
2020/04/06 23:17:14 9286#0: *105 "/wp-admin$" does not match "/wp-admin/setup-config.php", client: 36.148.77.36, server: 19kkk.com, request: "GET /wp-admin/setup-config.php HTTP/1.1", host: "www.19kkk.com"
2020/04/06 23:17:14 9286#0: *105 epoll_wait() reported that client prematurely closed connection, so upstream connection is closed too (104: Connection reset by peer) while sending request to upstream, client: 36.148.77.36, server: 19kkk.com, request: "GET /wp-admin/setup-config.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "www.19kkk.com"
2020/04/06 23:17:16 9287#0: *107 client closed connection while waiting for request, client: 36.148.77.36, server: 0.0.0.0:80


生产环境centos 7, VPS在香港,应该不存在备案白名单的问题,我也联系了服务商询问,他们没有限时访问.

系统防火墙没有开.

求教一下问题,希望大佬指点一下.

licess 发表于 2020-4-7 08:42:26

https://www.vpser.net/tag/wordpress%e6%96%b0%e6%89%8b%e7%b3%bb%e5%88%97%e6%95%99%e7%a8%8bwordpress教程上有明确的视频教程,没让开pathinfo吧,pathinfo是极个别的程序需要的,php程序文档上没说明就不需要开pathinfo
把 include enable-php-pathinfo.conf; 改成 include enable-php.conf; 然后重启nginx
页: [1]
查看完整版本: [求助]lnmp搭建wordpress的问题,大佬帮忙看看.