Install WordPress with Ubuntu 20.04, NGINX, MariaDB and PHP 7.4

Follow these 3 Steps and watch video. Need help? Contact me. 😊

  1. Setting up Cloudflare DNS
  2. Getting Ubuntu Server
  3. Deploying LEMP Stack
Step-by-Step how-to tutorial in easy words for absolute beginners

Part A: Keep Cloudflare Nameservers active

We will be using Cloudflare DNS for getting Let’s Encrypt Wildcard SSL certificate. Complete this step first to enjoy zero-downtime migration.

Check Current Nameservers

  • Find your active Nameservers at dnschecker.org/#NS/example.com
  • If you see using your previous Hosting or Domain registrar default NS, then you must replace with Cloudflare.

Enable Cloudflare DNS

  1. Create a new Cloudflare account
  2. Add your domain
  3. Verify DNS records
  4. Update NS.

Part B: Get a Ubuntu Server 20.04 LTS Server ready

Ubuntu logo

1. Sign up Vultr to grab $100 Free credits (Valid for 30 days)

As someone who have tried so many Cloud server company, my experience says you can’t go wrong with Vultr. These guys are genuine and caring when it comes to support and services.

vultr

⚡ Performance

  • NVME / SSD
  • 3.7 GHz CPU
  • Up to 5Gbps Network Speed
  • Datacenter in America, Europe, Asia, Austraillia
  • IPV6 ready

💡 Features

  • Beginner-Friendly Dashboard
  • One-click to Snapshot
  • Automtatic Backup (Paid)
  • Free Cloud Firewall
  • DDoS protection (Paid)
  • 100% KVM Virtualization

⚙ Support

  • PayPal/Card
  • 24/7 Ticket Support
  • Documentation

2. Create a new VPS Server

Simply click on the plus button to get started

Deploy New Server

3. Choose High Frequency Server

Choose Server

Select High frequency compute for the fastest experience. It uses 3.7 GHz CPU and NVME storage.

CPU Speed
CPU Speed

4. Choose a Server Location

Choose a server location that is close to your target audience.

location

Tip: If you are deploying a static WordPress on BunnyCDN Storage, select Germany for the fastest upload experience.

5. Select Ubuntu 20.04 x64 OS

This is a long term supported version. It is compatible with most packages that we are going to install.

6. Choose a Server Size

server size

$6/mo plan would be a great starting point for a new blog. You can upgrade anytime as per requirement.

Tip: If you are migrating, check Total installation size in Site health info.

7. Enable IPV6, Backup

Ignore Startup Script. This is not required. 👇

startup script

8. Add a SSH key

This is a recommended, optional step for the enhanced security.

Add SSH key
  1. Click on Add New button to add a new SSH key to submit your 🔒Public key.
  2. Generate Keys using below method as per your OS.
  • Download PuTTy application.
  • Search for PuTTygen in the Start menu
  • Click on Generate button and hover mouse pointer
  • Copy Public key and provide to Vultr
  • Enter key passphrase
  • Save 🔑Private Key at the safest location.
  • This can be used for login to SSH or SFTP.
  • Run: ssh-keygen -t rsa. For a more secure 4096-bit key, run: ssh-keygen -t rsa -b 4096
  • Press enter when asked where you want to save the key (this will use the default location).
  • Enter a passphrase for your key.
  • Run cat ~/.ssh/id_rsa.pub – this will give you the key in the proper format to paste into the control panel.
  • Make sure you backup the ~/.ssh/id_rsa file. This cannot be recovered if it is lost.

Select your SSH key

Following these steps will attach your public key to your new Instance. Then, you will be able to login to SSH using Plain Text password and SSH key both.

select SSH public key

9. Link Web Firewall rule to Server Instance

Firewall
  1. Click on Manage and create a new Firewall Group.
  2. Allow TCP port 22 for SSH. 80 for HTTP and 443 HTTPS for IPV4 and IPV6 rules both.
  3. Once done, link the Firewall group to your Instance.
firewall status
Accept TCP connection from 22, 80, 443 only
Link Firewall Group
Link firewall rule to new instance

10. Enter Hostname and label click Deploy Now

Now, you will see installing in the progress

Instance Installing

15. Go to New Instance page

Copy IP address, username and password. Your default port is 22.

16. Disable Password Login

For security reasons, it’s recommended to disable password authentication and allow only key based authentication.

  1. Edit the configuration file nano /etc/ssh/sshd_config
  2. Find (CTRL + W) and search PasswordAuthentication
  3. Change value from yes to no
  4. To save type, CTRL + O
  5. Restart the SSH service using command sudo service ssh restart
Disable Password Authentication

From the next time, you can use SSH via key only as shown in the video.

For Linux or Mac, use Terminal with command like this

ssh root@192.168.1.1 -p 22 -i id_rsa

Enough explanation for basic things. Now, I’ll speed up the original process for deploying WordPress on the LEMP stack.

Part C. Deploy WordPress on LEMP Stack

1. Update repositories

Type below command and press enter key

sudo -s
apt update && apt upgrade -y && apt dist-upgrade && apt autoclean && apt autoremove -y && reboot

or

wget -qO update https://www.gulshankumar.net/update && chmod +x update

Next time, always use below shortcut command to update.

./update

2. Install MariaDB with security

Login again and enter following command

sudo apt install mariadb-server -y && sudo mysql_secure_installation

Answer below questions

  • Enter current password for root (enter for none): Press Enter key
  • Set root password? [Y/n]: Press Enter key.
  • New password: Type your password, you can use Dashlane to generate. Right to click paste.
  • Re-enter new password: Re-type your password.

After successful password set, you will see

Password updated successfully!
Reloading privilege tables..
... Success!

Also, you need answer following questions.

Remove anonymous users? [Y/n]: Press Y and enter
Disallow root login remotely? [Y/n]: Press Y and enter
Remove test database and access to it? [Y/n]: Press Y and enter
Reload privilege tables now? [Y/n]: Press Y and enter

3. Create a new Database for WordPress

Login to MySQL, press enter key when it asks for password.

mysql -u root -p

Create a new Database, and Grant Privileges to use its user with password. This is where WordPress store all post, pages, themes, plugin, etc information.

create database wordpress;
grant all on wordpress.* to gulshan@localhost identified by '5pY8CKJxDRJEGQNkX7';
flush privileges;
exit;

Where your …
database is wordpress
username is gulshan
password is 5pY8CKJxDRJEGQNkX7

Tip: Consider using unique login credential

4. Install PHP 7.4, NGINX and set Permission

sudo add-apt-repository ppa:ondrej/php -y && apt update && apt install php7.4-fpm php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-soap php7.4-zip php7.4-bcmath -y && sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/7.4/fpm/php.ini && service php7.4-fpm restart && apt install nginx -y && chown -R www-data:www-data /var/www/ && chmod -R 755 /var/www

Tweak PHP Configuration

Most fancy theme and plugin requires high-end PHP configuration to run. Therefore, we should make this changes.

sed -i 's/memory_limit = 128M/memory_limit = 512M/g' /etc/php/7.4/fpm/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 128M/g' /etc/php/7.4/fpm/php.ini
sed -i 's/max_file_uploads = 20/max_file_uploads = 30/g' /etc/php/7.4/fpm/php.ini
sed -i 's/max_execution_time = 30/max_execution_time = 900/g' /etc/php/7.4/fpm/php.ini
sed -i 's/max_input_time = 60/max_input_time = 3000/g' /etc/php/7.4/fpm/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 128M/g' /etc/php/7.4/fpm/php.ini
service php7.4-fpm restart

5. Install Wildcard Let’s Encrypt SSL Certificate

Create a cloudflare.ini file inside /root/.secrets/ directory.

mkdir -p /root/.secrets/ && cd /root/.secrets/ && nano cloudflare.ini

Add below code and save using CTRL+O and exit using CTRL+X

dns_cloudflare_email = "your-cloudflare-email@example.com"
dns_cloudflare_api_key = "XXXXXXXXXXXXXXXXX"

Fnd your Cloudflare e-mail and Global API key at “My Profile” > API Tokens > Global API Key

chmod 0400 /root/.secrets/cloudflare.ini

Install Certbot and DNS Authenticator according to OS and HTTP web server

snap install --beta --classic certbot
snap set certbot trust-plugin-with-root=ok
snap install --beta certbot-dns-cloudflare
snap connect certbot:plugin certbot-dns-cloudflare

Get Wildcard SSL Certificate

certbot certonly --dns-cloudflare --dns-cloudflare-credentials /root/.secrets/cloudflare.ini -d example.com,*.example.com --preferred-challenges dns-01

Set Automatic Renewal using Cron Job

  • Type crontab -e
  • Type 1 for nano editor
  • Enter below command and save
0 0 * * *  /etc/init.d/nginx reload >/dev/null 2>&1

Test renewal

certbot renew --dry-run

6. Configure Nginx Server Block

This is important where you need configure your domain, how NGINX should handle your HTTP requests.

Delete default server blocks.

rm /etc/nginx/sites-available/default && rm /etc/nginx/sites-enabled/default

Create a new server block

cd /etc/nginx/sites-available/
nano example.com
  1. Replace example.com with own domain
  2. Your WordPress path is /home/315148.cloudwaysapps.com/daebcjsgtj/public_html/ directory, update if required for installing new WordPress at same server or if you want to rename HTML directory to site name.
  3. Enter below code and Press ctrl+o to save and ctrl+x to exit.
server {
    listen         80;
    return 301 https://$host$request_uri;
}
server {
root /var/www/html;
index index.php index.html index.htm;
server_name .example.com;
client_max_body_size 0;

    listen [::]:443 ssl http2 ipv6only=on;
    listen 443 ssl http2;
        ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
        ssl_prefer_server_ciphers on;
        ssl_session_cache   shared:SSL:20m;
        ssl_session_timeout 20m;
        ssl_ciphers 'TLS13+AESGCM+AES128:EECDH+AES128';

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}

location ~* \.php$ {
if ($uri !~ "^/uploads/") {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
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|svg|ico|jpeg|jpg|js|png)$ {
expires 1y;
log_not_found off;
}

# Enable Gzip compression.
gzip on;

# Disable Gzip on IE6.
gzip_disable "msie6";

# Allow proxies to cache both compressed and regular version of file.
# Avoids clients that don't support Gzip outputting gibberish.
gzip_vary on;

# Compress data, even when the client connects through a proxy.
gzip_proxied any;

# The level of compression to apply to files. A higher compression level increases
# CPU usage. Level 5 is a happy medium resulting in roughly 75% compression.
gzip_comp_level 5;

# Compress the following MIME types.
gzip_types
 application/atom+xml
 application/javascript
 application/json
 application/ld+json
 application/manifest+json
 application/rss+xml
 application/vnd.geo+json
 application/vnd.ms-fontobject
 application/x-font-ttf
 application/x-web-app-manifest+json
 application/xhtml+xml
 application/xml
 font/opentype
 image/bmp
 image/svg+xml
 image/x-icon
 text/cache-manifest
 text/css
 text/plain
 text/vcard
 text/vnd.rim.location.xloc
 text/vtt
 text/x-component
 text/x-cross-domain-policy;
}

If you want to use FastCGI Cache then implement below Server Block instead.

# follow nginx-helper default path
fastcgi_cache_path /var/www/cache levels=1:2 keys_zone=WORDPRESS:100m inactive=6h;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;

server {
    listen         80;
    return 301 https://$host$request_uri;
}
server {
root /var/www/html;
index index.php index.html index.htm;
server_name .example.com;
client_max_body_size 0;

    listen [::]:443 ssl http2 ipv6only=on;
    listen 443 ssl http2;
        ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
        ssl_prefer_server_ciphers on;
        ssl_session_cache   shared:SSL:20m;
        ssl_session_timeout 20m;
        ssl_ciphers 'TLS13+AESGCM+AES128:EECDH+AES128';

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;


set $skip_cache 0;
    if ($request_method = POST) {set $skip_cache 1;}
    if ($request_uri ~* "/wp-admin/|/xmlrpc.php|/wp-.*.php|index.php|sitemap(_index)?.xml") {set $skip_cache 1;}
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {set $skip_cache 1;}
    if ($query_string = "unapproved*") {set $skip_cache 1;}
    if ($cookie_woocommerce_items_in_cart = "1" ){ set $skip_cache 1;}
    if ($request_uri ~* "/(cart|checkout|my-account)/*$") {set $skip_cache 1;}

location / {
        try_files $uri $uri/ /index.php?$args;
}

# Pass all .php files onto a php-fpm or php-cgi server
location ~* \.php$ {
        try_files                       $uri =404;
        include                         /etc/nginx/fastcgi_params;
        fastcgi_param                   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass                    unix:/run/php/php7.4-fpm.sock;
        fastcgi_index                   index.php;
                fastcgi_cache_bypass $skip_cache;
                fastcgi_no_cache $skip_cache;
                fastcgi_cache WORDPRESS;
                fastcgi_cache_valid 200 301 24h;
                add_header X-Cache $upstream_cache_status;

}

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|svg|jpeg|jpg|js|png)$ {
expires 1y;
log_not_found off;
}

# Enable Gzip compression.
gzip on;

# Disable Gzip on IE6.
gzip_disable "msie6";

# Allow proxies to cache both compressed and regular version of file.
# Avoids clients that don't support Gzip outputting gibberish.
gzip_vary on;

# Compress data, even when the client connects through a proxy.
gzip_proxied any;

# The level of compression to apply to files. A higher compression level increases
# CPU usage. Level 5 is a happy medium resulting in roughly 75% compression.
gzip_comp_level 5;

# Compress the following MIME types.
gzip_types
 application/atom+xml
 application/javascript
 application/json
 application/ld+json
 application/manifest+json
 application/rss+xml
 application/vnd.geo+json
 application/vnd.ms-fontobject
 application/x-font-ttf
 application/x-web-app-manifest+json
 application/xhtml+xml
 application/xml
 font/opentype
 image/bmp
 image/svg+xml
 image/x-icon
 text/cache-manifest
 text/css
 text/plain
 text/vcard
 text/vnd.rim.location.xloc
 text/vtt
 text/x-component
 text/x-cross-domain-policy;
}

To save, press CTRL+O and Enter key. Then, exit nano editor using command CTRL+X.

In case of FastCGI, you need to use NGINX Cache plugin for purging Cache. Do note your Cache path is /var/www/cache this plugin is suitable for purging AMP cache well. Unfortunately, this works only with English blog.

Caution!

If you run a Hindi blog with encoded URL, please do not use NGINX Cache plugin instead use NGINX Helper instead with below snippet in as per this tutorial. If you have implemented custom cache path you can use below constant.

define('RT_WP_NGINX_HELPER_CACHE_PATH', '/var/www/cache/');
  • This plugin has one catch, it doesn’t purge AMP version. Also, my above FastCGI method has one limitation it works for responsive theme only.
  • For example, If you’re using Newspaper theme and serve seperate Mobile theme, please stick without FastCGI method and use a plugin WP Rocket because it can serve seperate mobile cache out of the box.

7. Create Symbolic links between two directories

To activate server block, create a symbolic link of your NGINX Server Block file from directory/etc/nginx/sites-available/ to /etc/nginx/sites-enabled.

Before running below command, please replace example.com to own domain.

ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

Test configuration

nginx -t

Restart and update

service nginx restart && service php7.4-fpm restart && service mysql restart && apt-get update && apt upgrade -y

7. Install WordPress

We are going to download WordPress core files in /var/www/html directory

cd /var/www/html && wget https://wordpress.org/latest.tar.gz && tar -xvzf latest.tar.gz && mv -v wordpress/* /var/www/html && rm -rf index.nginx-debian.html latest.tar.gz wordpress && chown -R www-data:www-data /var/www/ && sudo chmod -R 755 /var/www

To update permission in future, use below command

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

8. Override hosts file

This is suitable for advanced user generally for local machine for performing zero downtime migration. This can be useful for live server as well to prevent proxy-mess. I generally prefer incase of Static WordPress Development area. 😉

  • There are two ways to point DNS. If you are migrating site to Vultr and want to test first locally then edit your hosts file and point there.

For Windows

  • Go to properties of ‪C:\Windows\System32\drivers\etc\hosts
  • Change “Security” permission to full control for your current Username
  • Now you can freely edit the hosts file under your System user and save it.
# For same machine you can have localhost address
127.0.0.1 example.com
127.0.0.1 www.example.com
# or keep public IP for different machine

An example, this is how it should look

For Mac or Linux

cd && nano /etc/hosts
  • If everything is perfect and you want to make your site live, Login to Cloudflare DNS and update new IP
A ---------- @ -----------> Server IPV4 address
AAAA ------- @ -----------> Server IPV6 address
CNAME ------www -----------------> example.com

where @ denotes naked domain example.com

9. Visit your domain name to setup WordPress

If you want to keep non-www version domain for your WordPress then visit non-www version else www.

https://example.com
  • Provide Database login credential to begin WordPress Setup
  • Run Installation
  • Fill up Basic details of your new Site and Install WordPress.
  • Login to WordPress
  • If you used FastCGI server block then first thing you should do is installing NGINX Cache plugin and configuring /var/www/cache as cache path.

Shall I use NGINX inbuilt FastCGI Caching system?

Of course! Yes, FastCGI Caching system will to handle 3x more traffic than regular plugin that uses PHP for serving.

Which Caching plugin should I use with LEMP stack?

NGINX Cache works perfectly fine to purge FastCGI cache.

Will my Let’s Encrypt auto renew?

Yes, using Cron Job. The renewal happen automatically.

How to securely deploy multiple WordPress sites at same server?

You need to create seperate user and group for each site to process their PHP execution. Follow our tutorial for more details.

Finally, the WordPress Installation has been completed successfully with LEMP. I greatly appreciate your valuable time for reading this article. See you in the next tutorial!

External resources

Any question? Please ask at Gulshan Forum.

47 thoughts on “Install WordPress with Ubuntu 20.04, NGINX, MariaDB and PHP 7.4”

  1. Thanks a lot gulshran .you save my breath

    i search everywhere but not find any good article

    you explained very well along with security concern

    well done

  2. Thanks a lot gulshran .you save my breath

    i search everywhere but not find any good article

    you explained very well along with security concern

    well done

  3. Thank you for your tutorial, its the first one that actually showed me the wordpress setup page.

    When I went to upload a plugin I received this message. “The uploaded file exceeds the upload_max_filesize directive in php.ini”

    How do I increase the max filesize?

  4. Thank you for your tutorial, its the first one that actually showed me the wordpress setup page.

    When I went to upload a plugin I received this message. “The uploaded file exceeds the upload_max_filesize directive in php.ini”

    How do I increase the max filesize?

  5. Add below cron job

    crontab -e

    Add below command and save.

    15 3 * * 7 certbot renew --post-hook "service nginx restart"

  6. Add below cron job

    crontab -e

    Add below command and save.

    15 3 * * 7 certbot renew --post-hook "service nginx restart"

  7. Hello Gulshan Bro, First i want to say you that this is very beautiful and required post. I am really appreciating your work. but i have a problem can you please tell me
    i have a droplet with digitalocean ($5/month plan) and i want to host multiple wordpress sites only with nginx(lemp ubuntu 18.04).
    In simple i mean that this tutorial is complete to install a single wordpress and i did it but tell host it in some other sites

  8. Hello Gulshan Bro, First i want to say you that this is very beautiful and required post. I am really appreciating your work. but i have a problem can you please tell me
    i have a droplet with digitalocean ($5/month plan) and i want to host multiple wordpress sites only with nginx(lemp ubuntu 18.04).
    In simple i mean that this tutorial is complete to install a single wordpress and i did it but tell host it in some other sites

  9. Hey Rohit,

    Assuming, second site is example2.org

    You need to follow steps this way.

    1. create a new directory and add WordPress (Ref: steps 31)

    cd /var/www/
    mkdir example2
    wget https://wordpress.org/latest.tar.gz
    tar -xvzf latest.tar.gz
    mv -v wordpress/* /var/www/example2
    rm -rf index.nginx-debian.html latest.tar.gz wordpress
    chown -R www-data:www-data /var/www/
    sudo chmod -R 755 /var/www

    2. Create a new Server block with root path located to new directory as created in step 1.


    cd /etc/nginx/sites-available/
    nano gulshankumar-org

    server {
    listen 80;
    root /var/www/example2;
    index index.php index.html index.htm;
    server_name example2.org www.example2.org;
    ...

    3. Point your example2.org domain to DNS, then install SSL

    certbot --nginx -d example2.org -d www.example2.org

    4. Create new MySQL database
    sudo mysql -u root -p
    create database example2;
    grant all on example2.* to example2@localhost identified by 'TYPE HERE PASSWORD';
    flush privileges;
    exit;

    5. Proceed to Installation by visiting your site https://example2.org

    Let me know if you have any additional question. You can always visit our forum for quick assistance.

    Thanks & Regards,
    Gulshan

  10. Hey Rohit,

    Assuming, second site is example2.org

    You need to follow steps this way.

    1. create a new directory and add WordPress (Ref: steps 31)

    cd /var/www/
    mkdir example2
    wget https://wordpress.org/latest.tar.gz
    tar -xvzf latest.tar.gz
    mv -v wordpress/* /var/www/example2
    rm -rf index.nginx-debian.html latest.tar.gz wordpress
    chown -R www-data:www-data /var/www/
    sudo chmod -R 755 /var/www

    2. Create a new Server block with root path located to new directory as created in step 1.


    cd /etc/nginx/sites-available/
    nano gulshankumar-org

    server {
    listen 80;
    root /var/www/example2;
    index index.php index.html index.htm;
    server_name example2.org www.example2.org;
    ...

    3. Point your example2.org domain to DNS, then install SSL

    certbot --nginx -d example2.org -d www.example2.org

    4. Create new MySQL database
    sudo mysql -u root -p
    create database example2;
    grant all on example2.* to example2@localhost identified by 'TYPE HERE PASSWORD';
    flush privileges;
    exit;

    5. Proceed to Installation by visiting your site https://example2.org

    Let me know if you have any additional question. You can always visit our forum for quick assistance.

    Thanks & Regards,
    Gulshan

  11. If your WordPress General Settings has www version, server will do automatically. No additional action is required. In case you started WordPress installation at non-www version, then you need to migrate by changing at Database level.

  12. If your WordPress General Settings has www version, server will do automatically. No additional action is required. In case you started WordPress installation at non-www version, then you need to migrate by changing at Database level.

  13. Hey Gulshan,
    In the 7th step while texting ngnix I got
    nginx: [emerg] open() “/etc/nginx/sites-enabled/example.com” failed (2: No such file or directory) in /etc/nginx/nginx.conf:62
    nginx: configuration file /etc/nginx/nginx.conf test failed

    This error. How I can solve it? also what the error.

  14. Please delete your existing server block and create again at sites-available and symlink at sites-enabled directory. The step 6 and 7 cover that clearly. Consider following patiently without any error. If you still face any problem, do let me know. Thanks for taking to leave your valuable comment.

  15. How to check if fastcgi cache is working or not? while running sudo curl -I https://example.com it is not showing x-cache parameter

  16. I am facing problem of infinite loop redirects. I had use fastcache code. how to fix it

  17. Hi Gulshan, I am also receiving the test failed error on step 7. I have tried several times now on different setup and still stuck here. Please could you help?

  18. Please carefully read the post and then copy-paste code in Terminal. Sometime you need to replace with your own domain. Doing mistake can return error. Else, no wise. I use this guide everyday for myself. I am not aware about any problem.

    In case of trouble
    1. Run test using nginx -t
    2. Check logs to get proper hint tail -f /var/log/nginx/error.log

    3. Delete existing or earlier created virtualhost
    rm /etc/nginx/sites-available/default && rm /etc/nginx/sites-enabled/default
    4. Make sure to replace example.com at all places, a) when you create conf file, its naming. b) when you add conf file and c) when you create symlink, check your command its conf file name must match with first process.

    I feel in most cases, chances are you did not replaced server_name .example.com; to own domain, or you did not obtained SSL. All steps are written in serial order as it should be.

  19. This article is like Life-Saver for one of my website. I was about to move from Google Cloud to Digital Ocean because the trial was expired and I also wanted to use DigitaOcean because it is in-expensive yet powerful and gives great experience.

    Previously, I used webinoly stack which was straightforward for installing WordPress but later on I got to know from Gulshan that there are so many issues with that stack so, this time I was going to do it manually. I checked the official guide by Digital ocean but end up with many confusion and issues. Then, I fortunately asked Gulshan for help and he recommended this article for me.

    I installed WordPress easily and very fast even fast that Webinoly stack. Thanks a lot Gulshan for writing this amazing article. Hats off to you bro!!🎩

Leave a Comment