File magento-sample.conf-disabled of Package nginx
1
server {
2
include /etc/nginx/port.conf;
3
server_name example.com;
4
return 301 $scheme://www.example.com$request_uri;
5
}
6
7
server {
8
include /etc/nginx/port.conf;
9
#listen 443 ssl;
10
server_name www.example.com; ## Domain is here
11
root /var/www/html;
12
access_log /var/log/nginx/access_www.example.com.log main;
13
14
if ($http_user_agent = "") { return 444;}
15
16
####################################################################################
17
## SSL CONFIGURATION
18
19
#ssl_certificate /etc/ssl/certs/www_server_com.chained.crt;
20
#ssl_certificate_key /etc/ssl/certs/server.key;
21
22
####################################################################################
23
## Server maintenance block. insert dev ip 1.2.3.4 static address www.whatismyip.com
24
25
#if ($remote_addr !~ "^(1.2.3.4|1.2.3.4)$") {
26
#return 503;
27
#}
28
29
#error_page 503 @maintenance;
30
#location @maintenance {
31
#rewrite ^(.*)$ /error_page/503.html break;
32
#internal;
33
#access_log off;
34
#log_not_found off;
35
#}
36
37
####################################################################################
38
## 403 error log/page
39
40
#error_page 403 /403.html;
41
#location = /403.html {
42
#root /var/www/html/error_page;
43
#internal;
44
#access_log /var/log/nginx/403.log error403;
45
#}
46
47
####################################################################################
48
## Main Magento location
49
50
location / {
51
try_files $uri $uri/ @handler;
52
}
53
54
####################################################################################
55
## These locations would be hidden by .htaccess normally, protected
56
57
location ~ (/(app/|includes/|pkginfo/|var/|errors/local.xml)|/\.) {
58
deny all;
59
}
60
61
####################################################################################
62
## Protecting /admin/ and /downloader/ 1.2.3.4 = static ip (www.whatismyip.com)
63
64
#location /downloader/ {
65
#allow 1.2.3.4; allow 1.2.3.4; deny all;
66
#rewrite ^/downloader/(.*)$ /downloader/index.php$1;
67
#}
68
#location /admin {
69
#allow 1.2.3.4; allow 1.2.3.4; deny all;
70
#rewrite / /@handler;
71
#}
72
73
####################################################################################
74
## Images, scripts and styles set far future Expires header
75
76
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
77
open_file_cache max=10000 inactive=8h;
78
open_file_cache_valid 1h;
79
open_file_cache_min_uses 2;
80
open_file_cache_errors off;
81
expires max;
82
log_not_found off;
83
access_log off;
84
}
85
86
####################################################################################
87
## Main Magento location
88
89
location @handler {
90
rewrite / /index.php?$args;
91
}
92
93
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
94
rewrite ^(.*.php)/ $1 last;
95
}
96
97
####################################################################################
98
## Execute PHP scripts
99
100
location ~ .php$ {
101
add_header X-UA-Compatible 'IE=Edge,chrome=1';
102
add_header X-Time-Spent $request_time;
103
try_files $uri $uri/ =404;
104
fastcgi_pass 127.0.0.1:9000;
105
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
106
## Store code with multi domain
107
#fastcgi_param MAGE_RUN_CODE $storecode;
108
## Default Store code
109
fastcgi_param MAGE_RUN_CODE default;
110
fastcgi_param MAGE_RUN_TYPE store; ## or website;
111
include fastcgi_params; ## See /etc/nginx/fastcgi_params
112
}
113
}
114