-
Notifications
You must be signed in to change notification settings - Fork 19
/
nginx.conf
84 lines (68 loc) · 2.04 KB
/
nginx.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
user git git;
worker_processes 1;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 15;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server_names_hash_bucket_size 64;
server {
listen 80;
server_name MYSERVER;
access_log /var/log/nginx/MYSERVER.access.log combined;
error_log /var/log/nginx/MYSERVER.error.log error;
root /var/www/gitlist;
index index.php;
auth_basic "Restricted";
auth_basic_user_file /ng-auth/htpasswd;
#git SMART HTTP
location ~ /git(/.*\.git.*) {
client_max_body_size 0;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param GIT_PROJECT_ROOT /repos;
fastcgi_param PATH_INFO $1;
fastcgi_param REMOTE_USER $remote_user;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
#robots
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
#gitlist
location ~* ^/index.php.*$ {
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
#default
location / {
try_files $uri @gitlist;
}
#images
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
add_header Vary "Accept-Encoding";
expires max;
try_files $uri @gitlist;
tcp_nodelay off;
tcp_nopush on;
}
#gitlist
location @gitlist {
rewrite ^/.*$ /index.php;
}
}
}