Control Web Panel

WebPanel => Apache => Nginx => Topic started by: Uncoders on April 10, 2019, 10:37:04 PM

Title: Just Nginx run (wordpress permalink 404)
Post by: Uncoders on April 10, 2019, 10:37:04 PM
Hello all,

I m using WordPress latest version.  When i, change my web server like, Ngnix, i got 404 Error on my urls ?

What should i do ?

Thanks.
Title: Re: Just Nginx run (wordpress permalink 404)
Post by: Igor S. on April 12, 2019, 10:50:13 AM
Hi, you have to edit nginx Vhost configuration file and add the redirects.
The .htaccess does not work with nginx.
Title: Re: Just Nginx run (wordpress permalink 404)
Post by: Automata on November 07, 2019, 03:36:33 AM
PROBLEM SOLVED

Hi, i discovered a great website https://www.mysterydata.com/ with a great administrator where you can find many guides for CWP and more, also by registering for free on the forum i found the solution to this problem thanks to the courtesy and extreme availability of the administrator.

SOLUTION:

https://forum.mysterydata.com/topic/3/cwp-nginx-varnish-apache-with-php-fpm-server-how-to-configure-pretty-permalink-for-wordpress/2

Good day and good work to all !
Title: Re: Just Nginx run (wordpress permalink 404)
Post by: Richardmax on March 28, 2020, 06:41:34 PM
PROBLEM SOLVED

Hi, i discovered a great website https://www.mysterydata.com/ with a great administrator where you can find many guides for CWP and more, also by registering for free on the forum i found the solution to this problem thanks to the courtesy and extreme availability of the administrator.

SOLUTION:

https://forum.mysterydata.com/topic/3/cwp-nginx-varnish-apache-with-php-fpm-server-how-to-configure-pretty-permalink-for-wordpress/2

Good day and good work to all !

Hi,

I have the same issue but for subdomain sites only.

.htaccess is in the subdomain folder but nothing happens.

Another hand there is a line in nginx subdomain vhost that disable .htaccess but is not present in nginx default .conf

Code: [Select]
location ~* "/\.(htaccess|htpasswd)$" {deny all;return 404;}

How did you do it?

Thanks in advance
Title: Re: Just Nginx run (wordpress permalink 404)
Post by: rcschaff on March 28, 2020, 06:58:30 PM
PROBLEM SOLVED

Hi, i discovered a great website https://www.mysterydata.com/ with a great administrator where you can find many guides for CWP and more, also by registering for free on the forum i found the solution to this problem thanks to the courtesy and extreme availability of the administrator.

SOLUTION:

https://forum.mysterydata.com/topic/3/cwp-nginx-varnish-apache-with-php-fpm-server-how-to-configure-pretty-permalink-for-wordpress/2

Good day and good work to all !

Hi,

I have the same issue but for subdomain sites only.

.htaccess is in the subdomain folder but nothing happens.

Another hand there is a line in nginx subdomain vhost that disable .htaccess but is not present in nginx default .conf

Code: [Select]
location ~* "/\.(htaccess|htpasswd)$" {deny all;return 404;}

How did you do it?

Thanks in advance

nginx does not use .htaccess file.

Follow these Steps
1)  Log into the CLI via SSH
2)  Cd /usr/local/cwpsrv/htdocs/resources/conf/web_servers/vhosts/nginx/php-fpm
3) "   cp default.stpl wordpress.stpl  "  and   "   cp default.tpl  wordpress.tpl     "
4)  edit wordpress.stpl and wordpress.tpl (nano/vi)
5) Find location / {
6)  Immediately under that line add  "     try_files $uri $uri/ /index.php?$args;       "  and save it
7)  Log into CWP Admin panel
8)  Webservers -> Webservrs Domain Config
9)  Select user of domain running wordpress
10) Click Create Configuration
11)  Select NGINX-PHPFPM
12)  Nginx default vhost template type:  Set to PHP-FPM
13)  Nginx default vhost template:   Select Wordpress
14) Select your desired PHP-FPM Version
15) Check box to rebuild Webserver Config for domain.
16) Click Save

Wordpress should now work
 Repear 9-16 for other wordpress installations.
Title: Re: Just Nginx run (wordpress permalink 404)
Post by: Richardmax on March 28, 2020, 07:04:36 PM
Hi rcschaff. Thanks, for answer

I have magento websites also. That will not affect the sites with magento? Excuse my ignorance but it is the first time in my professional life that I use something other than Apache  :-\
Title: Re: Just Nginx run (wordpress permalink 404)
Post by: rcschaff on March 28, 2020, 07:35:31 PM
Not if you set it on a per user/domain instance.
Title: Re: Just Nginx run (wordpress permalink 404)
Post by: Richardmax on March 28, 2020, 08:52:35 PM
Hi rcschaff. Thanks, for answer

I have magento websites also. That will not affect the sites with magento? Excuse my ignorance but it is the first time in my professional life that I use something other than Apache  :-\

Great!!

It works fine!!

by the way I made two more changes to the .stpl file:

1- Add ssl directive to each "listen ..."
locate:
Code: [Select]
listen %ip%:%nginx_port% %http2%;replaced by:
Code: [Select]
listen %ip%:%nginx_port% ssl %http2%;
2- Removed each:
Code: [Select]
ssl on;
The above to avoid the nginx warning:
Quote
nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl"

Thank very much rcschaff!!