需要配置的字段记不太清楚,存个模板下次安装直接粘贴

站点配置文件

server {
    listen   80;
    listen   [::]:80;
    listen   443 ssl http2;
    listen   [::]:443 ssl http2;
    server_name    domain;
    index   index.php index.html;
    root   /var/www/wwwroot/website;
    access_log /var/www/wwwlog/website.log;
    
    # HTTPS相关配置
    ssl_certificate   /var/www/wwwssl/website/website.pem;
    ssl_certificate_key   /var/www/wwwssl/website/website.key;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;

    # 强制HTTPS
    if ($server_port !~ 443){
        rewrite ^(/.*)$ https://$host$1 permanent;
    }

    # 伪静态规则,需根据程序修改
    if (!-e $request_filename) {
        rewrite  ^/(.*)$  /index.php/$1  last;
        break;
    }

    include /etc/nginx/default.d/php.conf;
    include /etc/nginx/default.d/pathinfo.conf;
}

Nginx配置文件 nginx.conf

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
    use epoll;
    worker_connections 102400;
}

http {
    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  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    server_tokens off;

    gzip on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_comp_level 2;
    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary off;
    gzip_disable "MSIE [1-6]\.";

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    include /etc/nginx/conf.d/php-fpm.conf;
    include /var/www/conf/*.conf;
}

标签: none

添加新评论