vhp1360 Posted October 23, 2018 Share Posted October 23, 2018 (edited) hello dears. There is a issue with NGINX configurations. I tried to setup prestashop on CentOS 7 with Nginx according to this instrument that I found similar this in Prestashop forums . the nginx.config file is as below: user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; events { worker_connections 1024; } http { client_header_timeout 300; client_body_timeout 300; fastcgi_read_timeout 300; client_max_body_size 32m; fastcgi_buffers 8 128k; fastcgi_buffer_size 128k; map $http_upgrade $connection_upgrade { default upgrade; '' close; } log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 6500; types_hash_max_size 3048; include /etc/nginx/mime.types; default_type application/octet-stream; include /etc/nginx/conf.d/*.conf; include nginx-prestashop.conf; } and nginx-prestashop.conf file is: upstream php-fpm { server 127.0.0.1:9000; #unix:/run/php-fpm/www.sock; } server { listen 0.0.0.0:80; root /var/www/html/prestashop; index index.php index.html index.htm; server_name example.com www.example.com; server_name_in_redirect off; error_log /var/log/nginx/error.log; location / { rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last; rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2.jpg last; rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3.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.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.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.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.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.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.jpg last; rewrite ^/c/([0-9]+)(-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last; rewrite ^/c/([a-zA-Z-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1.jpg last; rewrite ^/([0-9]+)(-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last; try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_index index.php; fastcgi_pass php-fpm; include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } server { listen 0.0.0.0:443; server_name example.com www.example.com; server_tokens off; error_log /var/log/nginx/error.log; server_name_in_redirect off; ssl on; ssl_certificate /etc/nginx/sslnginx.crt; ssl_certificate_key /etc/nginx/sslnginx.key; ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM- SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4"; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; ssl_session_timeout 5m; location / { proxy_redirect http://127.0.0.1:80/ $scheme://$host:443/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; } location ~ /\.ht { deny all; } } insight of server, every things is ok but when I tried http://www.example.com or https://www.example.com/ , it redirects me to localhost/index.phph?I removed default configs.I could not find the reason. Edited October 23, 2018 by vhp1360 (see edit history) Link to comment Share on other sites More sharing options...
vhp1360 Posted October 25, 2018 Author Share Posted October 25, 2018 any answer? Link to comment Share on other sites More sharing options...
Knowband Plugins Posted October 25, 2018 Share Posted October 25, 2018 Hi, NGINX config seems fine to me. I believe you have copied to DB & Code from the local to the server? If Yes, Kindly confirm if you updated the URL in DB (in shop_url table) ? Link to comment Share on other sites More sharing options...
vhp1360 Posted October 26, 2018 Author Share Posted October 26, 2018 hello, thanks for replay. I conn't got you. could please give me more information? Link to comment Share on other sites More sharing options...
vhp1360 Posted October 28, 2018 Author Share Posted October 28, 2018 I'm new in prestashop, please help me Link to comment Share on other sites More sharing options...
vhp1360 Posted October 29, 2018 Author Share Posted October 29, 2018 Ok, finally I got you and correct my db. but https://example.com redirect to http://example.com. what shall I do? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now