VPS侦探论坛

 找回密码
 注册
查看: 3242|回复: 1

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

[复制链接]
发表于 2020-4-6 23:21:21 | 显示全部楼层 |阅读模式

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


这是 nginx.conf 配置文件
  1. user  www www;

  2. worker_processes auto;
  3. worker_cpu_affinity auto;

  4. error_log  /home/wwwlogs/nginx_error.log  debug;

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

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

  8. events
  9.     {
  10.         use epoll;
  11.         worker_connections 51200;
  12.         multi_accept off;
  13.         accept_mutex off;
  14.     }

  15. http
  16.     {
  17.         include       mime.types;
  18.         default_type  application/octet-stream;

  19.         server_names_hash_bucket_size 128;
  20.         client_header_buffer_size 32k;
  21.         large_client_header_buffers 4 32k;
  22.         client_max_body_size 50m;

  23.         sendfile on;
  24.         sendfile_max_chunk 512k;
  25.         tcp_nopush on;

  26.         keepalive_timeout 60;

  27.         tcp_nodelay on;

  28.         fastcgi_connect_timeout 300;
  29.         fastcgi_send_timeout 300;
  30.         fastcgi_read_timeout 300;
  31.         fastcgi_buffer_size 64k;
  32.         fastcgi_buffers 4 64k;
  33.         fastcgi_busy_buffers_size 128k;
  34.         fastcgi_temp_file_write_size 256k;

  35.         gzip on;
  36.         gzip_min_length  1k;
  37.         gzip_buffers     4 16k;
  38.         gzip_http_version 1.1;
  39.         gzip_comp_level 2;
  40.         gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
  41.         gzip_vary on;
  42.         gzip_proxied   expired no-cache no-store private auth;
  43.         gzip_disable   "MSIE [1-6]\.";

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

  46.         server_tokens off;
  47.         access_log off;

  48. include vhost/*.conf;
  49. }
复制代码


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

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

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

  12.         include enable-php-pathinfo.conf;

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

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

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

  24.         location ~ /\.
  25.         {
  26.             deny all;
  27.         }

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

  30. server
  31.     {
  32.         listen 443 ssl http2;
  33.         #listen [::]:443 ssl http2;
  34.         server_name 19kkk.com www.19kkk.com;
  35.         index index.html index.htm index.php default.html default.htm default.php;
  36.         root  /home/wwwroot/19kkk.com;

  37.         ssl_certificate /usr/local/nginx/conf/ssl/19kkk.com/fullchain.cer;
  38.         ssl_certificate_key /usr/local/nginx/conf/ssl/19kkk.com/19kkk.com.key;
  39.         ssl_session_timeout 5m;
  40.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  41.         ssl_prefer_server_ciphers on;
  42.         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";
  43.         ssl_session_cache builtin:1000 shared:SSL:10m;
  44.         # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
  45.         ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;

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

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

  50.         include enable-php-pathinfo.conf;

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

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

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

  62.         location ~ /\.
  63.         {
  64.             deny all;
  65.         }

  66.         access_log  /home/wwwlogs/19kkk.com.log;
  67.     }
复制代码


这是 enable-php-pathinfo.conf 配置文件
  1.         location ~ [^/]\.php(/|$)
  2.         {
  3.             fastcgi_pass  unix:/tmp/php-cgi.sock;
  4.             fastcgi_index index.php;
  5.             include fastcgi.conf;
  6.             include pathinfo.conf;
  7.         }
复制代码


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

  4. # Add trailing slash to */wp-admin requests.
  5. rewrite /wp-admin$ $scheme://$host$uri/ permanent;
复制代码


这是 error 日志信息,我看上去觉得客户端在请求两次之后就断开链接了,然后报了104,不太明白咋回事.
  1. 2020/04/06 23:17:12 [notice] 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"
  2. 2020/04/06 23:17:12 [notice] 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"
  3. 2020/04/06 23:17:12 [info] 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"
  4. 2020/04/06 23:17:13 [notice] 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"
  5. 2020/04/06 23:17:13 [notice] 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"
  6. 2020/04/06 23:17:13 [info] 9286#0: *99 client 36.148.77.36 closed keepalive connection (104: Connection reset by peer)
  7. 2020/04/06 23:17:13 [info] 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
  8. 2020/04/06 23:17:13 [notice] 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"
  9. 2020/04/06 23:17:13 [info] 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"
  10. 2020/04/06 23:17:14 [notice] 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"
  11. 2020/04/06 23:17:14 [info] 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"
  12. 2020/04/06 23:17:16 [info] 9287#0: *107 client closed connection while waiting for request, client: 36.148.77.36, server: 0.0.0.0:80
复制代码


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

系统防火墙没有开.

求教一下问题,希望大佬指点一下.
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2020-4-7 08:42:26 | 显示全部楼层


https://www.vpser.net/tag/wordpr ... 7%e6%95%99%e7%a8%8b  wordpress教程上有明确的视频教程,没让开pathinfo吧,pathinfo是极个别的程序需要的,php程序文档上没说明就不需要开pathinfo
把 include enable-php-pathinfo.conf; 改成 include enable-php.conf; 然后重启nginx
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-11-20 23:20 , Processed in 0.025449 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表