WordPress Nginx config
-
Is this an okay config for nginx or is there something I should change?
location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } error_page 404 /index.php; location ~ \.php$ { #Hide xmlrpc.php location ~ /xmlrpc.php { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_index index.php; include fastcgi_params; deny all; return 403; } #Hide login except for on my ip location ~ /wp-login.php { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_index index.php; include fastcgi_params; allow 83.555.93.556; deny all; } try_files $uri =404; #Hide .php not within WordPress fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } # Hide any backup or SQL dump files location ~ ^.+\.(sql|bak|php~|php#|php.save|php.swp|php.swo)$ { return 404; } # Disable all .dot files except for .well-known location ~ /\.(?!well-known).* { deny all; return 403; } #Disable Directory Listing autoindex off;
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘WordPress Nginx config’ is closed to new replies.