NginxでのWordPress設定

LINEで送る
Pocket

  • conf.d/hoge.com.conf
server {
    listen       80;
    server_name  blog.adachin.me;
    return 301 https://dev.adachin.me$request_uri;
}


server {
    listen       443 ssl;
    server_name  blog.adachin.me;
    root /var/www/wordpress;
    index index.html index.php;
    access_log      /var/log/nginx/blog.adachin.me.ssl.access.log;
    error_log       /var/log/nginx/blog.adachin.me.ssl.error.log;
    ssl_certificate /etc/letsencrypt/live/blog.adachin.me/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/blog.adachin.me/privkey.pem;
    try_files $uri $uri/ /index.php?q=$uri&$args;

    location ~ \.php$ {
            fastcgi_pass  unix:/var/run/php/php7.0-fpm.sock;
            fastcgi_index   index.php;
            fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
            include        fastcgi_params;
    }
}
  • nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 1024;
}

http {
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        log_format main '[nginx]\t'
                        'time:$time_iso8601\t'
                        'server_addr:$server_addr\t'
                        'host:$remote_addr\t'
                        'method:$request_method\t'
                        'reqsize:$request_length\t'
                        'uri:$request_uri\t'
                        'query:$query_string\t'
                        'status:$status\t'
                        'size:$body_bytes_sent\t'
                        'referer:$http_referer\t'
                        'ua:$http_user_agent\t'
                        'forwardedfor:$http_x_forwarded_for\t'
                        'reqtime:$request_time\t'
                        'apptime:$upstream_response_time\t';

        access_log /var/log/nginx/access.log main;

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        gzip on;
        gzip_http_version 1.0;
        gzip_disable "msie6";
        gzip_proxied any;
        gzip_min_length 1024;
        gzip_comp_level 6;
        gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
        open_file_cache max=100000 inactive=20s;
        open_file_cache_valid 30s;
        open_file_cache_min_uses 2;
        open_file_cache_errors on;
        gzip_vary on;
        gzip_static on;

        proxy_buffer_size 32k;
        proxy_buffers 50 32k;
        proxy_busy_buffers_size 32k;
        client_max_body_size 50M;

        include /etc/nginx/conf.d/*.conf;
}

 

Was this helpful?

0 / 0

コメントを残す 0

Your email address will not be published. Required fields are marked *