Score:-1

How to secure the WordPress site running on Nginx

tk flag

Can someone explain to me some important Nginx server configurations to have a secure WordPress site?

cocomac avatar
cn flag
That's going to depend on how 'secure' it needs to be. Are you running a small blog that you don't want to get hacked? Or are you hosting content that might make a nation state want to attack you? You have to consider _what_ you're trying to defend against, and have a level of defense to match that. Also, **never** have password-protected SSH publicly available. If you have to have SSH be public, then **require** SSH keys for all accounts. And use something like [ssh-audit](https://pypi.org/project/ssh-audit/) to secure it. [Here](https://bit.ly/35mHfT3) is the `sshd_config` that I use.
Score:0
tr flag

If an attacker decides to gain control of your WordPress website, the attacker may be able to get some PHP scripts into the uploads directory. To prevent these requesting files, the below-given location directives will inspect the requests. If the files are ending in .php deny them all. This is denied by the Nginx and restricts access to certain clients.

location ~* .(pl|cgi|py|sh|lua)$ {
    return 444;
}

And also use the below-given location directives to prevent visitors from getting sensitive information about your WordPress site.

location ~ /(.|wp-config.php|wp-comments-post.php|readme.html|license.txt) {
    deny all;
}

I hope these two points will be supportive for you and, if you need to get more tips, refer to this article: WordPress site running on Nginx. Thank you!

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.