We are runnning a Wordpress web site on nginx + php-fpm7 on Ubuntu. We have problems with Unbounce plugin and their support cannot help. The plugin has a popup, which dynamically creates a page (.html) which loads inside the popup. Since this file physically doesn't exist the nginx returns a 404 (see screenshot). How can I configure the nginx to pass this request further to php-fpm?
This is my try_files directive in my nginx config:
location /
{
try_files $uri $uri/ /index.php?$args;
}
My full nginx configuration is here. Does anyone have an idea of how to achieve this?
Related
I don't understand why my nginx.conf file does not work.
This is just supposed to serve a static web site.
Later I want to add a wordpress to /blog.
Currently I want to make the main static site work.
The related conf is this:
location / {
index index.html
root /var/www/html/xlanding;
try_files $uri $uri/ =406;
}
This nginx is dockerized. I log in to the docker container and I can confirm that /var/www/html/xlanding/ exists and there is an index.html file there.
When I visit the url I see a 406 error (just changed from 404 to confirm that block is entered). So the block is matched.
How can I fix this?
Ah, I missed a semicolon after the "index index.html".
I installed prestashop in my localhost. I can login to admin and saw the dashboard. But when I went to other menu, it said 404 not found. The problem was in dashboard, it is using url like index.php?controller , but in other menu it is using admin/index.php. I installed the software under ps directory.
OK - http://localhost/ps/admin/index.php?controller=AdminDashboard&token=3fca2bcd5f31ce3c1cdf951bf5620720#/preview
FAIL - http://localhost/ps/admin/index.php/sell/catalog/products?_token=IIPIHFzRMTdRMvjXGeCiFocCWVXBiwUhWgJIAhgzvtA
Here is my nginx default site configuration inside server {}
location /ps {
root /var/www/;
index index.php;
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$args;
location ~ /ps/(.+\.php)$ {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
}
}
I am using nginx version 1.18.0 and prestashop version 1.7.8.3 on ubuntu 20.04.4.
My question is, how to fix the nginx setting especially the try_files part so that I can access prestashop's other menu? If that is not possible, how to disable pretty url in prestashop?
Prestashop comes with built-in Apache rewriting rules,
so using a NGINX only enviroment could be troublesome.
You preferably have to switch to Apache as-persystem requirements :
https://devdocs.prestashop.com/1.7/basics/installation/system-requirements/
or consider using Nginx as a reverse proxy for static resources and Apache to serve PHP requests, so native htaccess will work out of the box.
Anyway , have a look at Nginx-specific Prestashop rules:
https://devdocs.prestashop.com/1.7/basics/installation/nginx/
to be integrated in your conf file.
While, in order to completely disable URL rewriting,
you can act on a backoffice setting "URL rewriting" in SEO&URL part, if you are not able to reach that page, you can just adjust "PS_REWRITING_SETTINGS" to 0 in ps_configuration table in your database.
I'm not sure if this will work with the backoffice routes that are now based on Symfony framework, though.
I have deployed my AngularJS application in Openshift 4.3. We have created route to launch application. While creating route we gave hostname and path.So route created is https://pts-dev.exmaple.com/pts-ui. But when I try to launch application using route it does not work unless and until I add trailing slash to URL https://pts-dev.exmaple.com/pts-ui. It should actually append trailing slash automatically and should launch application. So to make it work I just edited below part in my Nginx conf file and the URL .
location / {
try_files $uri /pts-ui/index.html;
}
Initially I had the location like below with $uri/ which I removed in above snippet.
location / {
try_files $uri $uri/ /pts-ui/index.html;
}
I am unable to understand how removing uri/ made it worked? Can anyone explain me this?
Switching from Apache to NGINX here :)
So I have Site A which sits on the root directory http://test.fake.com/ and works fine. I also have another Wordpress Site (B) where the root is http://test.fake.com/b/
All the front end pages for B load scripts and css like http://test.fake.com/test.fake.com/b/ which of course is incorrect. When I try to goto the Admin like http://test.fake.com/wp-admin/ I receive No input file specified. as the only output, also the URL changes to http://test.fake.com/test.fake.com/b/wp-login.php.
Here is a snippet of my NGINX config where I think the problem lies, please let me know if you need more info and be gentle on a NGINX n00b :P
location /b {
try_files $uri $uri/ /b/index.php$args;
}
location / {
# Set try_files according WP architecture
try_files $uri $uri/ /index.php$args;
}
Here is a snippet of B's wp-config file where I am setting the URLs
define('WP_HOME','http://test.fake.com/b');
define('WP_SITEURL','http:/test.fake.com/b');
I have no idea where the error lies :(
Thank you for viewing!
MediaWiki installation was in domain.com/subdirectory and worked with Apache as the server.
Pages were found domain.com/subdirectory/index.php/Main_Page
The server was changed to NGINX the other night. WordPress and XenForo work fine but the location block for MediaWiki isn't working properly.
Since I'm new to NGINX and the configuration file inner workings, I'm not sure how to write the location block to get the results equal to the Apache page layout (index.php shows).
This is my latest attempt (failed, of course).
#MEDIAWIKI
location /subdirectory/ {
try_files $uri $uri /index.php?query_string;
}
This writes to domain.com/subdirectory/title and the index.php is missing.
The documents show writing to a subdomain and this is not what I'm wanting. The index.php also needs to remain.
Thank you for providing as much information so this is solved. For example, I'm not sure if LocalSettings needs modification.
Try adding
index index.php index.html;
Updated*
location /subdirectory/ {
index index.php index.html;
}
Using Rewrite
rewrite ^ /index.php?$request_uri;
this will forward requests to /subdirectory/index.php?
In your case, /subdirectory/index.php?/Main_Page