-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvhost.conf
60 lines (49 loc) · 2.03 KB
/
vhost.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#create a file on /etc/nginx/sites-available/VHOST.conf
server {
listen 80; ## listen for ipv4; this line is default and implied
server_name VHOST.MYSITE.com;
root /usr/share/nginx/www;
index index.html index.htm;
userid on;
userid_name uid;
userid_domain MYSITE.com;
userid_expires max;
set $myid $uid_got;
location = /crossdomain.xml {
echo "<?xml version=\"1.0\"?><!DOCTYPE cross-domain-policy SYSTEM \"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\"><cross-domain-policy><allow-access-from domain=\"*\" /></cross-domain-policy>";
expires modified +24h;
access_log off;
error_log /var/log/nginx/error.log;
}
location / {
if ($uid_got = ""){
set $myid $uid_set;
}
expires -1;
# return 204; #use this if you want an empty response
empty_gif; #use this if you want an empty gif response
}
location /healthcheck {
try_files $uri $uri $uri =404;
access_log off;
error_log /var/log/nginx/error.log;
}
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
access_log off;
error_log /var/log/nginx/error.log;
}
# !!!!!!!!!!!!!!!!!!!!
# the log format is for Amazon AWS only, if you have the real IP, change
# the ip variable to $remote_addr
log_format VHOST '$ip - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$myid"';
# /mnt is the AWS's fastest partition
access_log /mnt/log/nginx/VHOST.access.log VHOST;
error_log /mnt/log/nginx/VHOST.error.log;
}