• DevOps
    Case Study

    How we helped a development company rebuild DevOps for efficiency and scale.

    READ CASESTUDY
    icon

    24/7 DevOps as a Service

    Round-the-clock DevOps for uninterrupted efficiency.

    icon

    Infrastructure as a Code

    Crafting infrastructure with ingenious code.

    icon

    CI/CD Pipeline

    Automated CI/CD pipeline for seamless deployments.

    icon

    DevSecOps

    Integrated security in continuous DevOps practices.

    icon

    Hire DevOps Engineers

    Level up your team with DevOps visionaries.

    icon

    Consulting Services

    Navigate success with expert DevOps consulting.

  • TechOps
    Case Study

    How a US hosting leader scaled with us!

    READ CASESTUDY

    WEB HOSTING SUPPORT

    icon

    HelpDesk Support

    Highly skilled 24/7 HelpDesk Support

    icon

    Product Support

    Boost your product support with our expertise.

    MANAGED SERVICES

    icon

    Server Management

    Don’t let server issues slow you down. Let us manage them for you.

    icon

    Server Monitoring

    Safeguard your server health with our comprehensive monitoring solutions.

    STAFF AUGMENTATION

    icon

    Hire an Admin

    Transform your business operations with our expert administrative support.

    icon

    Hire a Team

    Augment your workforce with highly skilled professionals from our diverse talent pool.

  • CloudOps
    Case Study

    How we helped a Private Deemed University in India, save US $3500/m on hosting charges!

    READ CASESTUDY
    icon

    AWS Well Architected Review

    Round-the-clock for uninterrupted efficiency

    icon

    Optimize

    Efficient CloudOps mastery for seamless cloud management

    icon

    Manage

    Automated CI/CD pipeline for seamless deployments

    icon

    Migrate

    Upgrade the journey, Migrate & Modernize seamlessly

    icon

    Modernize

    Simplify compliance complexities with our dedicated services

    icon

    FinOps as a Service

    FinOps as a Service

  • SecOps
    Case Study

    Enabling financial grade platforms through strategic cloud modernisation.

    READ CASESTUDY
    icon

    VAPT

    Vulnerability Assessment and Penetration Testing

    icon

    Source Code Review

    Ensuring source code security ans safe practices to reduce risks

    icon

    Security Consultation

    On demand services for improving server security

    icon

    System Hardening

    Reduced vulnerability and proactive protection

    icon

    Managed SoC

    Monitors and maintains system security. Quick response on incidents.

    icon

    Compliance as a Service

    Regulatory compliance, reduced risk

  • Insights
    Case Study

    How we helped a Private Deemed University in India, save US $3,500/m on hosting charges!

    READ CASESTUDY
    icon

    Blog

    Explore our latest articles and insights

    icon

    Case Studies

    Read about our client success stories

    icon

    Flipbook

    Explore our latest Flipbook

    icon

    Events

    Join us at upcoming events and conferences

    icon

    Webinars

    Watch our educational webinar series

  • Our Story
  • Contact Us

Interested to collaborate?

Get in touch with us!

Ready to elevate your business with certified cloud expertise? Contact us today to learn how our team can help you leverage cloud technology to drive growth, streamline operations, and enhance security.

  • AWSAWS
  • Azure CloudAzure Cloud
  • Google CloudGoogle Cloud
  • Akamai CloudAkamai Cloud
  • OVHOVH
  • Digital OceanDigital Ocean
  • HetznerHetzner
  • Managed Services Overview
  • Kubernetes Consulting
  • DevOps as a Service
  • Infrastructure Monitoring
  • Kubernetes Consultancy Services
  • K8s & Cloud native Solutions
  • 24/7 Infrastructure Monitoring
  • DevOps as a Service
  • Cloud CI/CD Solutions
  • White Labeled MSP Support
  • Our story
  • Life@SupportSages
  • Insights
  • Careers
  • Events
  • Services
  • Managed Services

aws partneraws advanced partner
LinkedInFacebookXInstagramYouTube
SupportSages

Copyright © 2008 – 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy

WordPress Permalink configuration for Nginx

Author Profile
George K.
  • 4 min read
WordPress Permalink configuration for Nginx

Generating audio, please wait...

On Nginx WordPress Permalinks we came across an issue where all links in a WP/Osclass site throws 404 error. This is a typical behaviour of WP/Osclass permalinks configuration issue.

The first step is to confirm it is a Nginx WordPress permalinks issue.

The configuration file for Nginx is /etc/nginx/nginx.conf and it specified the log file for Nginx as /var/log/nginx/error.log

The error log contained the following information

 2014/02/03 06:17:04 [error] 18596#0: *1538 "/home/user/public_html/demo/index.php" is not found (2: No such file or directory), client: xx.xx.xx.xx, server: www.domain.com, request: xxxxxx/xxxx/xx " host: "domain.com/demo" 

The folder “demo” was missing in the document root.

The .htaccess file had the following entries for WP permalink activation


<IfModule mod_rewrite>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Hower Nginx won’t accept .htaccess file and the permalinks specified in the file will not applied. Hence  custom redirect rules are to be added in the Nginx configuration file.

Let us have detailed look into the configuration file. The Virtual host entry configuration details specified in /etc/nginx/nginx.conf are given below


# Virtual Host Configs
include /etc/nginx/conf.d/*.conf;
include /opt/pifpm/sites-enabled/*.conf;
include /opt/pifpm/sites-proxied/*.conf;

As mentioned in the above entries the active virtual host entries are stored in the location /opt/pifpm/sites-enabled/

root@hostname[/opt/pifpm/sites-enabled]# ls -l
total 40
drwxr-xr-x. 2 root root 4096 Feb 3 06:26 ./
drwxr-xr-x. 17 root root 4096 Jan 15 03:43 ../
-rw-r--r--. 1 root root 2202 Jan 10 17:09 forum.domain1.pl.conf
-rw-r--r--. 1 root root 2140 Jan 7 00:12 domain2.pl.conf
-rw-r--r--. 1 root root 2458 Jan 10 17:09 domain3.pl.conf

 

The domain in question is domain1.pl, hence the configuration is domain1..pl.conf . Let us have a look into it. The most relevant entries are given below

server {
listen xx.xx.xx.xx:80; ## listen for ipv4;

root /home/user/public_html/demo;
include /opt/pifpm/nginx.include.d/demo.domain1.pl.indexprio;

access_log /usr/local/apache/domlogs/demo.domain1.pl;

# Server name and its aliases
server_name www.demo.domain1.pl demo.domain1.pl;

include /opt/pifpm/nginx.include.d/demo.domain1.pl.autoinclude;

location / {include /opt/pifpm/nginx.include.d/demo.domain1.pl.include;}
##Additional_locations

 

As you can see from the configuration, it contains the IP, DocumentRoot, access_log location ,server name etc.

The permalink redirect rule for Nginx is given below

try_files $uri $uri/ /index.php?q=$uri&amp;$args;

Add this to the location directive include file ie /opt/pifpm/nginx.include.d/demo.domain1.pl.include

Once this is done, restart Nginx

/etc/init.d/nginx restart

If you receive the following error

# /etc/init.d/nginx restart
nginx: [emerg] "try_files" directive is duplicate in /opt/pifpm/nginx.include.d/demo.domain1.pl.include:1
nginx: configuration file /etc/nginx/nginx.conf test failed

It could be an issue with the directive. In such case, you need to  provide complete directive in the include file as given below

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

Once this is done, restart the  webserver

[~]# /etc/init.d/nginx restart

You can safely ignore the warnings and can proceed with the check. In my case, it worked like a charm

Get 24/7 expert server management

  • Apache
  • Howtos
  • Troubleshooting
WordPress Permalink configuration for Nginx

.htaccess based mod_rewrite not working with Godaddy ?

.htaccess based mod_rewrite not working with Godaddy ?
  • Apache
  • General
  • Howtos
  • Linux
logo

/proc explained

/proc explained
  • Linux
logo

A story of Ubuntu – I am what I am because of who we all are :)

A story of Ubuntu – I am what I am because of who we all are :)
  • General
  • Training
logo

Account Creation: Sorry, a mysql user with the name x already exists.

Account Creation:  Sorry, a mysql user with the name x already exists.
  • MySQL
  • Troubleshooting
logo

Posts by George K.

George started his career in web hosting and Linux technical support in the year 2004 and is with SupportSages since 2009. He has keen interest in server optimizations, custom security solutions, hacked server recovery, cyber forensic and high availability fail over system design and implementation. George loves long drives and is passionate about art and literature.