nginx.conf
nginx.ssl.conf
Code เดิมที่มีอยู่ตอนนี้server {
listen 172.0.0.0:80;
server_name xxxx.com
www.xxxx.com; 
root /home/admin/web/xxxx.com/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/xxxx.com.log combined;
access_log /var/log/nginx/domains/xxxx.com.bytes bytes;
error_log /var/log/nginx/domains/xxxx.error.log error;
//เพิ่มแบบนี้เหรอครับserver {
listen 80 default_server;
listen [:
:80 default_server;
server_name _;
return 301 https://$host$request_uri;
} location / {
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location /ecatalogs/ {
try_files $uri $uri/ /catalogs/index.php?$args;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;