• 注册
  • BBS
  • BBS
  • BBS
  • BBS
  • BBS
  • BBS
  • BBS Nginx 关注:2 内容:6

    Nginx配置80和443端口

  • 查看作者
  • 打赏作者
  • 拉黑名单
  • Lv.11
    十月你好

    生成aq2.cn_dh.pem和aq2.cn_tk.key

    		openssl dhparam -out aq2.cn_dh.pem 2048
    		
    		openssl rand 48 > aq2.cn_tk.key

    配置文件

    server {
                    server_name www.aq2.cn aq2.cn ;
                    listen 80;
                    listen 443  ssl http2;
                    index portal.php index.php index.html index.htm;
                    charset  utf-8;
                    root /data/wwwroot/www.aq2.cn;
    
            ssl_certificate      /data/nginx/conf/vhost/ssl/aq2.cn.pem;
            ssl_certificate_key  /data/nginx/conf/vhost/ssl/aq2.cn.key;
            ssl_session_timeout  5m;
            ssl_protocols        TLSv1 TLSv1.1 TLSv1.2;
            ssl_dhparam          /data/nginx/conf/vhost/ssl/aq2.cn_dh.pem;
            ssl_ciphers           EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
            ssl_session_cache          shared:SSL:50m;
            ssl_prefer_server_ciphers  on;
            ssl_session_tickets        on;
            ssl_session_ticket_key     /data/nginx/conf/vhost/ssl/aq2.cn_tk.key;
    
    if ($server_port = 80){ 
    	return 301 https://aq2.cn$request_uri;
    }
    location / {
            try_files $uri $uri/ /index.php?$args ;
        }
     location ~ \.php$ {
                            fastcgi_pass   php7a;
                            fastcgi_index  index.php;
                            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                            fastcgi_param  PHP_VALUE         open_basedir=$document_root:/tmp/:/proc/;
                            include        fastcgi_params;
            }
    
                    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
                                    expires      30d;
                    }
    
                    location ~ .*\.(js|css)?$ {
                                    expires      12h;
                    }
    
                    access_log  /data/nginx/logs/www.aq2.cn/access.log access;
                    error_log   /data/nginx/logs/www.aq2.cn/error.log error;
            }

    请登录之后再进行评论

    登录
  • 做任务
  • 实时动态
  • 偏好设置
  • 帖子间隔 侧栏位置: