I just do not come to the head.
I have a VPS with the characteristics in object: I have read at least a hundred articles on how to install / configure linux with nginx and prestashop, but I do not want to work.
1: Following this guide http://doc.prestashop.com/display/PS16/System+Administrator+Guide#SystemAdministratorGuide-NginxfriendlyURLs this part of the code do I have to insert it in my existing nginx.conf, or replace it? (tried always come 404)
2: I've also create a new one 100asa.it.con page with "Complete example configuration for nginx", but none, always 404
3: for this variable root / var / www / example I have to insert the directory of my prestashop (which is inside httpdocs?
Thank you for your help
Hi and thanks for your feedback. You're reading a PrestaShop 1.6 documentation.
Did you have a check on this file: https://github.com/PrestaShop/PrestaShop/blob/develop/docs/docker/nginx_fpm/prestashop-nginx/prestashop-nginx.conf
Can you send us your Nginx configuration please? We will try to reproduce.
Thanks @PierreRambaud: the file on your link where I've to put in?
apache otimization must me off? please let me know all prestashop settings to works with nginx
root must be in format var/www/vhosts/web.com/httpdocs/ (?)
attache my nginx.conf
nginx.zip
Can you add you nginx virtualhost please?
For the root directory, it only depends on what you add in your nginx / virtualhost configuraiont =)
attached
100asa.it.conf.zip
as suggest this article https://www.plesk.com/blog/various/set-virtual-host-configuration-files-plesk-tips/
I've to add prestashop-nginx directive info /var/www/vhosts/system/
on traffic&seo the friendly url button must be ON or off? .htaccess I must delete?
It's specific to Plesk configuration and not Nginx nor Debian, but look like yes.
You must edit your virtualhost configuration to be like this one: https://github.com/PrestaShop/PrestaShop/blob/develop/docs/docker/nginx_fpm/prestashop-nginx/prestashop-nginx.conf et least for gzip & location configuration.
for example this is the nginx.conf for my subdomain crm.100asa.it
so what do you suggest to have url rewrite?
nginx.zip
None!
I've try to add only: https://1ce.org/1#BkLSSo-PX
and enable "friendly url" ==>
always 404 Not Found
maybe because I've 2 different language on prestashop?
Everything works fine with:
server {
listen 8080; ## listen for ipv4; this line is default and implied
listen [::]:8080 default ipv6only=on; ## listen for ipv6
root /home/prambaud/projects/prestashop/source/nginx;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name _;
# Add stdout logging
error_log /var/log/nginx/error.log info;
access_log /var/log/nginx/access.log;
# Redirect 404 errors to prestashop
error_page 404 /index.php?controller=404;
# Gzip Settings, convert all types.
gzip on;
gzip_vary on;
gzip_proxied any;
# Can be enhance to 5, but it can slow you server
# gzip_comp_level 5;
# gzip_min_length 256;
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;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
# Symfony controllers
location /admin-dev/ { # [REQUIRED EDIT] the name of your admin directory
if (!-e $request_filename) {
rewrite ^/.*$ /admin-dev/index.php last; # [REQUIRED EDIT] the name of your admin directory
}
}
# Cloudflare / Max CDN fix
location ~* \.(eot|otf|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
}
# Do not save logs for these
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
auth_basic off;
allow all;
log_not_found off;
access_log off;
}
location / {
# Redirect pretty urls to index.php
try_files $uri $uri/ /index.php?$args;
# Images
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;
# AlphaImageLoader for IE and fancybox
rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;
# Web service API
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
# Installation sandbox
rewrite ^(/install(?:-dev)?/sandbox)/(.*) /$1/test.php last;
}
# File security
# .htaccess .DS_Store .htpasswd etc
location ~ /\. {
deny all;
}
# Source code directories
location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor)/ {
deny all;
}
# Prevent exposing other sensitive files
location ~ \.(yml|log|tpl|twig|sass)$ {
deny all;
}
# Prevent injection of php files
location /upload {
location ~ \.php$ {
deny all;
}
}
location /img {
location ~ \.php$ {
deny all;
}
}
location ~ \.php$ {
# Verify that the file exists, redirect to index if not
try_files $fastcgi_script_name /index.php$uri&$args;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
}
I'm running with Debian 9.5, PHP7.2 (fpm) and friendly urls are enabled.
Why do you want to target httpdocs? Do you navigate with http://website-url.com/httpdocs?
so my root would be: var/www/vhosts/web.com/ (?)
do you have only one language or 2? because I've 2 languages
when I try to add these directives to nginx, plesk say me: "server" directive is not allowed here"
I've also try to disable url rewrite, using nginx, but memory and cpu are often on max values (75/80%)
Instead using apache+fpm and nginx as proxy, the cpu and memory are always at 25%
Yes I have two languages too, and everything still working fine.
I don't know how Plesk configure is Nginx server and how directory structure is configured.
It's a server configuration problem. As they said, if you use their UI to configure nginx, you can only add location. You must have a check with Plesk team about how to configure your virtual host with their configuration :/
A doubt arises: for prestashop 1.7 better to use apache or nginx?
For a shop with about 12k products and about 500 unique visitors/day?
If you're not comfortable with Nginx and fpm, I recommend you to use Apache, and php mod, this is the default configuration of many web servers.
Otherwise Apache event & php fpm (which offer a really good performance) but it's a little tricky to configure.
If you're a pro with nginx, and you know what you do (watch out with .htaccess, you need to replace all files with location directives) you can use Nginx and fpm which offer a better performance.
something strange: now I've enable fpm+nginx
www.100asa.it/en/ = 404 not found
instead the products url is available: https://www.100asa.it/en/wired-readers/10958-eia-steel-usb.html
and without add none!
So only the index page doesn't works! Why?
Now, what are you location directives configuration?
attached all my files into conf directory
100asa.it.zip
p.s.: but I've to delete the .htaccess file from root?
I don't see any rewrite rulles in your files. You must add them. Could be better if you directly see with Plesk team and letting them configure your shop with the virtual host I sent you :)
I'm solved using nginx as apache proxy, and only add to nginx_ip_default.conf
try_files $fastcgi_script_name /index.php$uri&$args;
after location ~ .php(/.*)?$ {
and try_files $uri $uri/ /index.php?$args;
after location ~ /$ {
Nice, we maybe can now close this issue if everything is ok for you? :)
Yes, you can close ths thread.
Thanks @PierreRambaud for your suggestions.
I'm solved using nginx as apache proxy, and only add to nginx_ip_default.conf
try_files $fastcgi_script_name /index.php$uri&$args;
after location ~ .php(/.*)?$ {
andtry_files $uri $uri/ /index.php?$args;
after location ~ /$ {
Hello!!
I dont find nginx_ip_default.conf ...
I only have in www/vhosts/system/mydomain/conf/ vhost_nginx.conf y nginx.conf. I add this lines but nothing :(
I also tried to add as "aditional directive" in plesk > nginx like
location ~ .php(/.*)?$ {
try_files $fastcgi_script_name /index.php$uri&$args;
}
location ~ /$ {
try_files $uri $uri/ /index.php?$args;
}
but the problem continues...
www.thesneakerone.com/en doesnt work but https://www.thesneakerone.com/en/nike works fine
Could you help me?
Thanks in advanced
Hi,
This issue is currently close, can you open a new one with more information about your configuration such as virtualhost :)
Regards,
Hi,
This issue is currently close, can you open a new one with more information about your configuration such as virtualhost :)
Regards,
Done, thanks!
sorry @PierreRambaud : with your nginx configuration thare are some url that not rewrite:
/it/index.php?controller=pricesdrop
/it/index.php?controller=newproducts
/it/index.php?controller=bestsales