ngxwpsyntax
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Thanks for replying, pro120. I couldn’t use any of the popular WordPress NGINX configurations because they didn’t work. For example, every time I add that location block you described[*], it breaks my site. Images won’t load, then javascript won’t load and it turns the site into a mess. Any idea why?
Here is the configuration I came up with that works:
server { server_name domain.tld www.domain.tld; add_header Cache-Control "public"; add_header X-Frame-Options "DENY"; limit_req zone=gulag burst=200 nodelay; expires max; listen 80; listen 443 ssl; include conf.d/ssl; root /usr/local/www/domain.tld; index index.html index.htm index.php; location = /favicon.ico { return 204; } location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ { deny all; } location ~ /\. { deny all; access_log off; log_not_found off; } location / { root /usr/local/www/wordpress; try_files $uri $uri/ /index.php?$args; location ~ \.php$ { include conf.d/php-fpm; } } location ~ \.php$ { include conf.d/php-fpm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/local/www/nginx-dist; } }And the included php-fpm:
fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; try_files $uri = 404; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_index index.php; fastcgi_intercept_errors on; fastcgi_ignore_client_abort off; fastcgi_connect_timeout 60; fastcgi_send_timeout 180; fastcgi_read_timeout 180; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code; fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name; include fastcgi_params;[*] the line that breaks my site:
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html|htm)$ { access_log off; expires max; }
Viewing 1 replies (of 1 total)