blob: e4311d3349cbffe4be144232ec6a8233943491a0 (
plain)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
#user http;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
# nginx warning in journal or `sudo nginx -t`: "could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size"
# default is 1024, I increased to 2048 and still throws warning, I increase 4096 and warning is gone
# not fully understood
# https://wiki.archlinux.org/title/nginx#Warning:_Could_not_build_optimal_types_hash
# https://nginx.org/en/docs/http/ngx_http_core_module.html
# https://nginx.org/en/docs/hash.html
# https://nginx.org/en/docs/http/server_names.html
types_hash_max_size 4096;
server {
listen 80;
# needed for ipv6
listen [::]:80;
# https://nginx.org/en/docs/http/configuring_https_servers.html#single_http_https_server
listen 443 ssl;
listen [::]:443 ssl;
server_name flylightning.xyz;
ssl_certificate /etc/nginx/flylightning.pem;
ssl_certificate_key /etc/nginx/flylightning.key;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /srv/http/master;
index index.html;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /usr/share/nginx/html;
#}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
server_name mirrors.flylightning.xyz;
ssl_certificate /etc/nginx/flylightning.pem;
ssl_certificate_key /etc/nginx/flylightning.key;
location / {
root /srv/http/mirrors;
autoindex on;
}
}
# https://wiki.archlinux.org/title/Cgit#Using_uwsgi
# https://wiki.gentoo.org/wiki/User:Halcon/HOWTO_cgit_uwsgi_nginx
# https://uwsgi-docs.readthedocs.io/en/latest/Nginx.html
# https://nginx.org/en/docs/http/ngx_http_uwsgi_module.html
# https://stackoverflow.com/questions/16182421/cgit-and-nginx-url-rewrite
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
server_name git.flylightning.xyz;
root /usr/share/webapps/cgit;
ssl_certificate /etc/nginx/flylightning.pem;
ssl_certificate_key /etc/nginx/flylightning.key;
# about nginx location regex:
# - https://nginx.org/en/docs/http/ngx_http_core_module.html#location
# - https://stackoverflow.com/a/59846239
# - note in nginx / only means / and no other meaning, so no need \/
# - ~ means case-sensitive regex
# about (?:) non-capturing group:
# - https://manifold.net/doc/radian/why_do_non-capture_groups_exist_.htm
# - non-capturing group won't capture things inside () which may use later like in sed \1
# - maybe improve a little bit performance by not storing things (not tested, also I did not read the source code)
# Serve static files with nginx
location ~ ^/(?:cgit\.(?:css|png)|robots\.txt|highlight\.css|mycgit\.css)$ {
root /usr/share/webapps/cgit;
expires 30d;
}
location / {
include uwsgi_params;
uwsgi_modifier1 9;
uwsgi_pass unix:/run/uwsgi/cgit.sock;
}
}
}
# vim: expandtab
|