Skip to content

Commit f17db87

Browse files
committed
create nginx config for magento 1
1 parent c2c6492 commit f17db87

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
upstream fastcgi_backend {
2+
server unix:/sock/docker.sock;
3+
}
4+
5+
server {
6+
listen 80;
7+
8+
server_name $MAGE_DOMAIN;
9+
10+
client_max_body_size 10M;
11+
12+
set $MAGE_ROOT /home/$WEB_USER/html;
13+
14+
root $MAGE_ROOT/$PUBLIC_DIR;
15+
16+
location / {
17+
index index.php;
18+
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
19+
expires 30d; ## Assume all files are cachable
20+
}
21+
22+
charset UTF-8;
23+
error_page 404 403 = /errors/404.php;
24+
add_header "X-UA-Compatible" "IE=Edge";
25+
26+
# Deny access to sensitive files
27+
## These locations would be hidden by .htaccess normally
28+
location /app/ { deny all; }
29+
location /includes/ { deny all; }
30+
location /lib/ { deny all; }
31+
location /media/downloadable/ { deny all; }
32+
location /pkginfo/ { deny all; }
33+
location /report/config.xml { deny all; }
34+
location /var/ { deny all; }
35+
36+
## Disable .htaccess and other hidden files
37+
location ~ /\. {
38+
deny all;
39+
access_log off;
40+
log_not_found off;
41+
}
42+
location @handler { ## Magento uses a common front handler
43+
rewrite / /index.php;
44+
}
45+
location ~ \.php/ { ## Forward paths like /js/index.php/x.js to relevant handler
46+
rewrite ^(.*\.php)/ $1 last;
47+
}
48+
49+
location ^~ /.well-known {
50+
alias $MAGE_ROOT/.well-known/;
51+
auth_basic off;
52+
allow all;
53+
}
54+
55+
# PHP entry point for main application
56+
location ~ \.php$ {
57+
try_files $uri =404;
58+
fastcgi_pass fastcgi_backend;
59+
fastcgi_buffers 1024 4k;
60+
61+
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
62+
fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
63+
fastcgi_read_timeout 600s;
64+
fastcgi_connect_timeout 600s;
65+
66+
fastcgi_index index.php;
67+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
68+
fastcgi_param PATH_INFO $fastcgi_path_info;
69+
fastcgi_param MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
70+
fastcgi_param MAGE_RUN_TYPE store;
71+
include fastcgi_params;
72+
}
73+
74+
gzip on;
75+
gzip_disable "msie6";
76+
77+
gzip_comp_level 6;
78+
gzip_min_length 1100;
79+
gzip_buffers 16 8k;
80+
gzip_proxied any;
81+
gzip_types
82+
text/plain
83+
text/css
84+
text/js
85+
text/xml
86+
text/javascript
87+
application/javascript
88+
application/x-javascript
89+
application/json
90+
application/xml
91+
application/xml+rss
92+
image/svg+xml;
93+
gzip_vary on;
94+
95+
# Banned locations (only reached if the earlier PHP entry point regexes don't match)
96+
location ~* (\.php$|\.htaccess$|\.git) {
97+
deny all;
98+
}
99+
}

0 commit comments

Comments
 (0)