we harmoyos 论坛

 找回密码
 立即注册
查看: 267|回复: 0

bbs.weharmonyos.com 的 nginx 配置

[复制链接]
  • TA的每日心情
    开心
    2024-1-19 14:48
  • 签到天数: 17 天

    [LV.4]偶尔看看III

    48

    主题

    77

    帖子

    1007

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    1007
    发表于 2023-12-30 09:37:25 | 显示全部楼层 |阅读模式
    1. ##
    2. # You should look at the following URL's in order to grasp a solid understanding
    3. # of Nginx configuration files in order to fully unleash the power of Nginx.
    4. # https://www.nginx.com/resources/wiki/start/
    5. # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
    6. # https://wiki.debian.org/Nginx/DirectoryStructure
    7. #
    8. # In most cases, administrators will remove this file from sites-enabled/ and
    9. # leave it as reference inside of sites-available where it will continue to be
    10. # updated by the nginx packaging team.
    11. #
    12. # This file will automatically load configuration files provided by other
    13. # applications, such as Drupal or Wordpress. These applications will be made
    14. # available underneath a path with that package name, such as /drupal8.
    15. #
    16. # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
    17. ##

    18. # Default server configuration
    19. #
    20. server {
    21.     #HTTPS的默认访问端口443。
    22.     #如果未在此处配置HTTPS的默认访问端口,可能会造成Nginx无法启动。
    23.     listen 443 ssl;

    24.     #填写证书绑定的域名
    25.     server_name bbs.weharmonyos.com;
    26.     index index.html index.htm index.php;
    27.     root  /home/harmony/www/bbs.weharmonyos.com;

    28.     #填写证书文件绝对路径
    29.     ssl_certificate cert/bbs.weharmonyos.com.pem;
    30.     #填写证书私钥文件绝对路径
    31.     ssl_certificate_key cert/bbs.weharmonyos.com.key;

    32.     ssl_session_cache shared:SSL:1m;
    33.     ssl_session_timeout 5m;

    34.     #自定义设置使用的TLS协议的类型以及加密套件(以下为配置示例,请您自行评估是否需要配置)
    35.     #TLS协议版本越高,HTTPS通信的安全性越高,但是相较于低版本TLS协议,高版本TLS协议对浏览器的兼容性较差。
    36.     ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    37.     ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;

    38.     #表示优先使用服务端加密套件。默认开启
    39.     ssl_prefer_server_ciphers on;
    40.    
    41.     #论坛相关配置
    42.     include ./rewrite/discuzx.conf;
    43.     include enable-php.conf;
    44.     location /nginx_status
    45.     {
    46.         stub_status on;
    47.         access_log   off;
    48.     }
    49.     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    50.     {
    51.         expires      30d;
    52.     }
    53.     location ~ .*\.(js|css)?$
    54.     {
    55.         expires      12h;
    56.     }
    57.     location ~ /.well-known {
    58.         allow all;
    59.     }
    60.     location ~ /\.
    61.     {
    62.         deny all;
    63.     }
    64.     access_log  /home/wwwlogs/access.log;
    65. }
    66. server {
    67.     listen 80;
    68.     listen [::]:80;
    69.     #填写证书绑定的域名
    70.     server_name bbs.weharmonyos.com;
    71.     #将所有HTTP请求通过rewrite指令重定向到HTTPS。
    72.     rewrite ^(.*)$ https://$host$1;
    73.     location / {
    74.         index index.html index.htm index.php;
    75.     }
    76. }
    复制代码

    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    手机版|小黑屋|we harmonyos 论坛 ( 粤ICP备 2022126345号 )

    GMT+8, 2024-5-7 03:22 , Processed in 0.044791 second(s), 24 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表