• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question URL rewriting not working with nginx

Oldiesmann

Basic Pleskian
Server operating system version
Ubuntu 22.04
Plesk version and microupdate number
Plesk Obsidian 18.0.67 Update #3
The forum software I use has an addon that rewrites URLs, and will automatically generate the appropriate nginx rules as well as writing a .htaccess file. However, when I paste the rules into the "additional directives for nginx" thing and save it, I still get 404 errors for everything when using nginx alone. I've tried restarting nginx but that doesn't change anything. Right now I'm doing this on a test site to avoid breaking anything important, but I'd like to have this work if possible.
 
What forum software are you using and want is the rules you're using?

Also is proxy mode enabled? If proxy mode is enabled you're basically using Apache which would also depend if how you have PHP configured (FPM application served by nginx, FPM application served by Apache, or FastCGI served by Apache) so double check how those are configured as well.
 
It's SMF and these are the rules the addon generates. The mod works fine when proxy mode is enabled regardless of the PHP configuration since it doesn't rewrite URLs for static files. This only happens when proxy mode is disabled and PHP is served by nginx.

Code:
# Rules for: profiles
rewrite ^profile/([^/]+)/?$ "/index.php?pretty;action=profile;user=$1" last;

# Rules for: boards
rewrite ^([-_!~*'()$a-zA-Z0-9]+)/?$ "/index.php?pretty&board=$1.0" last;
rewrite ^([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ "/index.php?pretty&board=$1.$2" last;

# Rules for: topics
rewrite ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ "/index.php?pretty&board=$1&topic=$2.0" last;
rewrite ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ "/index.php?pretty&board=$1&topic=$2.$3" last;

# Rules for: actions
rewrite ^(agreement|acceptagreement|activate|admin|announce|attachapprove|buddy|calendar)/?$ "/index.php?pretty&action=$1" last;
rewrite ^(clock|coppa|credits|deletemsg|dlattach|editpoll|editpoll2|findmember)/?$ "/index.php?pretty&action=$1" last;
rewrite ^(groups|help|helpadmin|jsmodify|jsoption|likes|lock|lockvoting)/?$ "/index.php?pretty&action=$1" last;
rewrite ^(login|login2|logintfa|logout|markasread|mergetopics|mlist|moderate)/?$ "/index.php?pretty&action=$1" last;
rewrite ^(modifycat|movetopic|movetopic2|notifyannouncements|notifyboard|notifytopic|pm|post)/?$ "/index.php?pretty&action=$1" last;
rewrite ^(post2|printpage|profile|quotefast|quickmod|quickmod2|recent|reminder)/?$ "/index.php?pretty&action=$1" last;
rewrite ^(removepoll|removetopic2|reporttm|requestmembers|restoretopic|search|search2|sendactivation)/?$ "/index.php?pretty&action=$1" last;
rewrite ^(signup|signup2|smstats|suggest|splittopics|stats|sticky|theme)/?$ "/index.php?pretty&action=$1" last;
rewrite ^(trackip|about:unknown|unread|unreadreplies|uploadAttach|verificationcode|viewprofile|vote)/?$ "/index.php?pretty&action=$1" last;
rewrite ^(viewquery|viewsmfile|who|\.xml|xmlhttp|forum)/?$ "/index.php?pretty&action=$1" last;
 
So I did a few tests, I was able to somewhat work but other things gets broken and when I checked the admin log in SMF it shows there are some undefined array so I'm thinking this is more of whatever that prettyurl plugin is trying to do is broken.

The rules that kinda worked you can find in the first post of pretty urls + nginx - SOLVED

My suggestion is to reach out to the developer of that pretty url addon to see what they say though.
 
Back
Top