分享几个nginx配置文件(没有fpm配置)

全屏阅读
  • 基本信息
  • 作者:
  • 作者已发布:924篇文章
  • 发布时间:2022年02月20日 23:50:42
  • 所属分类:Linux
  • 阅读次数:1031次阅读
  • 标签:

单swoole反向代理配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
server
{
    listen 80;
    server_name 域名(空格分隔可多个);
 
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
    client_max_body_size 20m;
    location / {
        proxy_pass_request_body on;
        proxy_pass_request_headers on;
        proxy_pass 代理地址:端口号;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;# 支持ws
        proxy_set_header Connection "Upgrade";#支持ws
    }
}

ssl swoole反向代理

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
server
{
    listen 443 ssl http2;
    server_name 域名;
 
    ssl_certificate  /ssl.pem证书地址;
    ssl_certificate_key  /ssl.key证书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_cache shared:SSL:10m;
    ssl_session_timeout 10m;
 
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
    client_max_body_size 20m;
    location / {
        proxy_pass 代理地址:端口号;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
    }
}
 
server {
    listen 80;
    server_name 域名;
    location / {
        rewrite ^/(.*)$ https://域名/$1 permanent;##由http自动跳转到https
    }
}

vue代理网站

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
server
{
    listen 80;
    server_name 域名(空格分隔可多个);
 
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
    client_max_body_size 20m;
     
    location / {
      try_files $uri $uri/ @rewrites;
    }
 
    location @rewrites {
      rewrite ^(.+)$ /index.html last;
    }
 
    location ~* \.(?:htm|html)$ {
      add_header Cache-Control "private, no-store, no-cache, must-revalidate";
    }
 
    location ~* \.(?:ico|css|js|gif|jpe?g|png|svg|ttf|woff|eot|crx)$ {
      expires max;
      add_header Pragma public;
      add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    }
}


顶一下
(0)
100%
订阅 回复
踩一下
(0)
100%
» 郑重声明:本文由mpxq168发布,所有内容仅代表个人观点。版权归恒富网mpxq168共有,欢迎转载, 但未经作者同意必须保留此段声明,并给出文章连接,否则保留追究法律责任的权利! 如果本文侵犯了您的权益,请留言。

目前有 0 条留言 其中:访客:0 条, 博主:0 条

给我留言

您必须 [ 登录 ] 才能发表留言!