Can't access WordPress on LEMP after following tutorial exactly. Tried both building LEMP manually and using 1-click LEMP app.

Posted December 19, 2018 1.7k views
WordPressGetting StartedLEMPUbuntu 18.04

Keep getting 403 Forbidden error. Firewall setup as per 1-click LEMP app default:
Status: active
To Action From

22/tcp LIMIT Anywhere
443/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
Nginx HTTP ALLOW Anywhere
22/tcp (v6) LIMIT Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
Nginx HTTP (v6) ALLOW Anywhere (v6)

Nginx server blocks working, can access html static sites no problem.
SSL certificates installed with Certbot, HTTP redirects to HTTPS no problem.

sudo chown -R www-data:www-data /var/www/
sudo chmod -R 755 /var/www

tried: sudo chown -R $USER:$USER /var/www/ (from my sudo user)

tried: sudo find /var/www/ -type d -exec chmod 755 {} \;
and: sudo find /var/www/ -type f -exec chmod 644 {} \;

restarted Nginx after each try, no luck. I’ve rebuilt my Droplet several times and have been beating my head against the wall for 3 days. I followed the tutorial exactly from:
but every time when I’m finished I get 403 Forbidden at
I am somewhat of a newbie but I am not stupid, and I find it hard to believe that I am the only one having this problem installing WordPress from the 1-click LEMP app. I got 2 WordPress sites working on LAMP with the 1-click WordPress app, but I want to use Nginx and I must conquer this! Please help!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers


Shall I know what’s inside

sudo nano /etc/nginx/sites-available/


After starting from scratch one more time with 1-click LEMP app and then installing WordPress, I think my problem was simply clearing my web browser cache. I’m not sure what I did wrong the first time, but thank you! I do have one question about the file you mentioned though. After several times through the process, I combined all the steps into a single template (before installing SSL certificates):

server {
listen 80;
root /var/www/;
index index.php index.html index.htm index.nginx-debian.html;

location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
    expires max;
    log_not_found off;

location / {
    # try_files $uri $uri/ =404;
    try_files $uri $uri/ /index.php$is_args$args;

location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;

location ~ /\.ht {
    deny all;

I used this to install WordPress for 3 domains, used CertBot to install certificates and had all 3 working until I logged into my terminal and it said ‘system restart required’ and after rebooting I cannot start Nginx. Sudo nginx -t says 'ok’ and 'successful’ but error log says:
[emerg] 3840#0: bind() to failed (98: Address already in use)
Any ideas?

Wow, ok, I found the problem. The 1-click LEMP app also installs Apache2, and after installing php7.2-gd and running apt upgrade Apache takes over port 80 and if you reboot your server Nginx will not start. I don’t know why Apache is installed with the 1-click LEMP but it would be nice if the docs would warn you because this was painful!