laravel nginxの設定

server {
  server_name 192.168.0.193;
  listen 100;
  add_header Strict-Transport-Security max-age=15768000;

  index web.html index.php index.htm; #讲希望显示的页面放前面(web.html)
  root /data/wwwroot/FMC/public/;#项目根目录地址
  charset utf-8;
   if ($host != "192.168.0.193"){
       set $block "${block}3";
   }
   if ($block = "0123"){
       return 444;
   }
    location ~ /.well-known {
        allow all;
    }
#配置你的的api请求
  location /api/ {
       root /data/wwwroot/FMC/public/;
       index index.php;
       try_files $uri $uri/ /index.php?$query_string;
  }
#配置你的超管的api请求
    location /adm/ {
         root /data/wwwroot/FMC/public/;
         index index.php;
         try_files $uri $uri/ /index.php?$query_string;
    }

    location /apptest {
        index /web.html;
       try_files $uri $uri/ /web.html;
    }

    #web后台的 如果你想你的域名/web访问
  location /web {
      index /web.html;
      try_files $uri $uri/ /web.html;
      proxy_connect_timeout 300s;
      proxy_send_timeout 900;
      proxy_read_timeout 900;
      proxy_buffer_size 128k;
      proxy_buffers 8 128k;
      proxy_busy_buffers_size 128k;
      proxy_redirect off;
      proxy_hide_header Vary;
      proxy_set_header Accept-Encoding '';
      proxy_set_header Referer $http_referer;
      proxy_set_header Cookie $http_cookie;
      proxy_cookie_path ~*^/.* /;

      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
  }
  
    #超管的 如果你想你的域名/test访问
location /test {
      index /admin.html;
      try_files $uri $uri/ /admin.html;
      proxy_connect_timeout 300s;
      proxy_send_timeout 900;
      proxy_read_timeout 900;
      proxy_buffer_size 128k;
      proxy_buffers 8 128k;
      proxy_busy_buffers_size 128k;
      proxy_redirect off;
      proxy_hide_header Vary;
      proxy_set_header Accept-Encoding '';
      proxy_set_header Referer $http_referer;
      proxy_set_header Cookie $http_cookie;
      proxy_cookie_path ~*^/.* /;

      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
  }
#配置你的超管的api请求
location /adm {
      index /admin.html;
      try_files $uri $uri/ /admin.html;
      proxy_connect_timeout 300s;
      proxy_send_timeout 900;
      proxy_read_timeout 900;
      proxy_buffer_size 128k;
      proxy_buffers 8 128k;
      proxy_busy_buffers_size 128k;
      proxy_redirect off;
      proxy_hide_header Vary;
      proxy_set_header Accept-Encoding '';
      proxy_set_header Referer $http_referer;
      proxy_set_header Cookie $http_cookie;
      proxy_cookie_path ~*^/.* /;

      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
  }

#配置你的正常的api请求

  location / {
      #root   /usr/local/nginx/html;
      #index index.php index.html index.htm;
      try_files $uri $uri/ /index.php?$query_string;
      #index /index.html;
      #try_files $uri $uri/ /index.html;
      # try_files $uri $uri/ /web.html;
      proxy_connect_timeout 300s;
      proxy_send_timeout 900;
      proxy_read_timeout 900;
      proxy_buffer_size 128k;
      proxy_buffers 8 128k;
      proxy_busy_buffers_size 128k;
      proxy_redirect off;
      proxy_hide_header Vary;
      proxy_set_header Accept-Encoding '';
      proxy_set_header Referer $http_referer;
      proxy_set_header Cookie $http_cookie;
      proxy_cookie_path ~*^/.* /;

      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;

  }

  location /thtappsra_dmintransfer {

      rewrite ^/rapidzwebsocket/(.*)        /$1 break;
      proxy_pass_header Server;
      proxy_set_header Host $http_host;
      proxy_redirect off;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Scheme $scheme;
      #proxy_pass http://rapidzwebsocket/rapidzapi;

      #allow 192.168.0.7;
      #allow 192.168.0.1;
      #allow 112.73.1.92;
      #deny all;
  }

 location /htlongconnect {
      rewrite ^/rapidzwebsocket(.*)        $1 break;
      proxy_next_upstream error;
      gzip on;
      gzip_min_length 1000;
      gzip_proxied any;
      proxy_buffering off;
      keepalive_timeout 65;
      #proxy_pass http://rapidzwebsocket/rapidzwebsocket;
      proxy_read_timeout 60s;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Scheme $scheme;
      proxy_set_header Host $http_host;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "Upgrade";
      #proxy_set_header Connection $connection_upgrade;
  }

  #location @router {
  #   rewrite ^.*$ /admin.html last;
  #}

 location ~ [^/]\.php(/|$) {
    #fastcgi_pass remote_php_ip:9000;
    fastcgi_pass unix:/tmp/php-cgi.sock; #php cgi 路径
    fastcgi_index index.php;
    include fastcgi.conf;
  }

  #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;
  }

}

 

公開された263元の記事 ウォン称賛46 ビュー370 000 +

おすすめ

転載: blog.csdn.net/qq_27229113/article/details/103920544