nginx维护html模板,nginx https配置模板

正文

user root;

worker_processes 1;

#error_log /usr/local/nginx/logs/error.log error;

#error_log /usr/local/nginx/logs/error.log notice;

#error_log /usr/local/nginx/logs/error.log info;

#pid logs/nginx.pid;

events {

worker_connections 1024;

}

http {

include mime.types;

default_type application/octet-stream;

#开启http的debug level 系统日志

error_log /usr/local/nginx/logs/error.log debug;

#定义访问日志格式并使用

log_format main '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for"';

access_log /usr/local/nginx/logs/access.log main;

#使用sendfile 内核拷贝传输文件

sendfile on;

keepalive_timeout 65;

server {

# 单IP多域名的时候使用,可分不到不同的server块,此处不必

#server_name 120.79.215.199 host1.sshsu.top;

#开启ssl: nginx version > 1.15.0

listen 8086 ssl;

#开启ssl: nginx version < 1.15.0

#listen 8086;

#ssl on;

charset utf-8;

ssl_session_cache shared:SSL:10m;

ssl_session_timeout 10m;

#设置证书和私钥

ssl_certificate /root/certs/Nginx/1_host1.sshsu.top_bundle.crt;

ssl_certificate_key /root/certs/Nginx/2_host1.sshsu.top.key;

# 路径匹配

location / {

root /root/git/janus-gateway/html;

index index.html index.htm;

}

}

}

原文:https://www.cnblogs.com/ishen/p/12217697.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: 以下是一个nginx配置文件的模板示例: ``` access_log /usr/local/nginx/logs/access.log main; server_tokens off; sendfile on; #tcp_nopush on; upstream backend { server 127.0.0.1:8010 weight=1; server 127.0.0.1:8080 weight=2; server 127.0.0.1:8030 weight=1 backup; } location / { proxy_pass http://backend; } location /idi2.0 { proxy_pass http://127.0.0.1:8004; add_header Location $host; root /apps/idi/web; if (-d $request_filename){ rewrite ^/(.*)(\[^/\])$ $scheme://$host/$1$2/ permanent; } index index.html index.htm; } location /idiApp { proxy_pass http://127.0.0.1:8003; add_header Location $host; root /apps/idi/web; if (-d $request_filename){ rewrite ^/(.*)(\[^/\])$ $scheme://$host/$1$2/ permanent; } index index.html index.htm; } location /iidi/ { proxy_pass http://127.0.0.1:8005/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host:$server_port; proxy_redirect off; add_header Access-Control-Allow-Origin *; add_header Content-Security-Policy "default-src 'self'"; add_header Referrer-Policy: origin; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } ``` 这个模板包含了一些常见的nginx配置项,如日志记录、负载均衡、代理等。你可以根据自己的需求进行修改和扩展。 #### 引用[.reference_title] - *1* *3* [nginx配置模板](https://blog.csdn.net/weizhen1209/article/details/131081228)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [nginx常用配置模板](https://blog.csdn.net/sly1311220942/article/details/123423983)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值