通过端口可以访问 ,nginx代理后php没解析

anxin
server {
  listen 80;
  listen 443 ssl http2;
  ssl_certificate /usr/local/nginx/conf/ssl/center.hnlianzhu.com.crt;
  ssl_certificate_key /usr/local/nginx/conf/ssl/center.hnlianzhu.com.key;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
  ssl_prefer_server_ciphers on;
  ssl_session_timeout 10m;
  ssl_session_cache builtin:1000 shared:SSL:10m;
  ssl_buffer_size 1400;
  add_header Strict-Transport-Security max-age=15768000;
  ssl_stapling on;
  ssl_stapling_verify on;
  server_name center.hnlianzhu.com;
  access_log off;
  index index.html index.htm index.php;
  root /data/wwwroot/center.hnlianzhu.com/center/public;

  include /usr/local/nginx/conf/rewrite/thinkphp.conf;
  #error_page 404 /404.html;
  #error_page 502 /502.html;

  location ~ \.php {
    proxy_pass http://127.0.0.1:8808;
    proxy_http_version 1.1;
    proxy_set_header X-Real-IP $remote_addr;
  }

  location /wss
  {
    proxy_pass http://127.0.0.1:8803;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header X-Real-IP $remote_addr;
  }

  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    expires 30d;
    access_log off;
  }
  location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
  }
  location ~ /\.ht {
    deny all;
  }
}

http://139.199.125.236:8808/

{
"code": "-9999",
"msg": "未指定api,或者api地址不存在",
"time": 1545381989,
"data": []
}

https://center.hnlianzhu.com/

<?php
namespace think;

require __DIR__ . '/../thinkphp/base.php';

Container::get('app')->run()->send();
3262 1 0
1个回答

anxin

已经解决,真的是nginx配置文件多一点都不行

server {
  listen 80;
  listen 443 ssl http2;
  ssl_certificate /usr/local/nginx/conf/ssl/center.hnlianzhu.com.crt;
  ssl_certificate_key /usr/local/nginx/conf/ssl/center.hnlianzhu.com.key;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
  ssl_prefer_server_ciphers on;
  ssl_session_timeout 10m;
  ssl_session_cache builtin:1000 shared:SSL:10m;
  ssl_buffer_size 1400;
  add_header Strict-Transport-Security max-age=15768000;
  ssl_stapling on;
  ssl_stapling_verify on;
  server_name center.hnlianzhu.com;
  access_log off;
  #index index.html index.htm index.php;
  #root /data/wwwroot/center.hnlianzhu.com/center/public;

  #include /usr/local/nginx/conf/rewrite/thinkphp.conf;
  #error_page 404 /404.html;
  #error_page 502 /502.html;

  location /
  {
    proxy_pass http://127.0.0.1:8808;
    proxy_http_version 1.1;
    proxy_set_header X-Real-IP $remote_addr;
  }

  location /wss
  {
    proxy_pass http://127.0.0.1:8803;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header X-Real-IP $remote_addr;
  }
}
  • 暂无评论
年代过于久远,无法发表回答
🔝