TA的每日心情 | 开心 2024-1-19 14:48 |
---|
签到天数: 17 天 [LV.4]偶尔看看III
管理员
- 积分
- 1007
|
- ##
- # You should look at the following URL's in order to grasp a solid understanding
- # of Nginx configuration files in order to fully unleash the power of Nginx.
- # https://www.nginx.com/resources/wiki/start/
- # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
- # https://wiki.debian.org/Nginx/DirectoryStructure
- #
- # In most cases, administrators will remove this file from sites-enabled/ and
- # leave it as reference inside of sites-available where it will continue to be
- # updated by the nginx packaging team.
- #
- # This file will automatically load configuration files provided by other
- # applications, such as Drupal or Wordpress. These applications will be made
- # available underneath a path with that package name, such as /drupal8.
- #
- # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
- ##
- # Default server configuration
- #
- server {
- #HTTPS的默认访问端口443。
- #如果未在此处配置HTTPS的默认访问端口,可能会造成Nginx无法启动。
- listen 443 ssl;
- #填写证书绑定的域名
- server_name bbs.weharmonyos.com;
- index index.html index.htm index.php;
- root /home/harmony/www/bbs.weharmonyos.com;
- #填写证书文件绝对路径
- ssl_certificate cert/bbs.weharmonyos.com.pem;
- #填写证书私钥文件绝对路径
- ssl_certificate_key cert/bbs.weharmonyos.com.key;
- ssl_session_cache shared:SSL:1m;
- ssl_session_timeout 5m;
- #自定义设置使用的TLS协议的类型以及加密套件(以下为配置示例,请您自行评估是否需要配置)
- #TLS协议版本越高,HTTPS通信的安全性越高,但是相较于低版本TLS协议,高版本TLS协议对浏览器的兼容性较差。
- ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
- ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
- #表示优先使用服务端加密套件。默认开启
- ssl_prefer_server_ciphers on;
-
- #论坛相关配置
- include ./rewrite/discuzx.conf;
- include enable-php.conf;
- location /nginx_status
- {
- stub_status on;
- access_log off;
- }
- location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
- {
- expires 30d;
- }
- location ~ .*\.(js|css)?$
- {
- expires 12h;
- }
- location ~ /.well-known {
- allow all;
- }
- location ~ /\.
- {
- deny all;
- }
- access_log /home/wwwlogs/access.log;
- }
- server {
- listen 80;
- listen [::]:80;
- #填写证书绑定的域名
- server_name bbs.weharmonyos.com;
- #将所有HTTP请求通过rewrite指令重定向到HTTPS。
- rewrite ^(.*)$ https://$host$1;
- location / {
- index index.html index.htm index.php;
- }
- }
复制代码
|
|