-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
140 lines (118 loc) · 4.67 KB
/
nginx.conf
File metadata and controls
140 lines (118 loc) · 4.67 KB
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
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /tmp/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
# nginx hardening
server_tokens off;
client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp_path;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
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 /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /opt/app-root/etc/nginx.d/*.conf;
map_hash_bucket_size 128;
map $uri $new_uri {
default "";
/acerca-de /about;
/portafolio /work-experience;
/contacto /about;
/tags/noticias-informaticas /tags/it-news;
/tags/platicas-y-congresos /tags/talks-and-events;
/tags/programacion /tags/programming;
/tags/redes-sociales /tags/social-media;
/tags/tecnologia /tags/technology;
/tags/soluciones /tags/solutions;
/tags/tutoriales /tags/tutorials;
/tags/hola-mundo /tags/hello-world;
/tags/juegos /tags/gaming;
/tags/hacking-etico /tags/ethical-hacking;
/tags/eventos /tags/events;
/tags/noticias /tags/news;
/tags/ciclos-excesivos /tags/linux-debugging;
/tags/discos-duros /tags/storage;
/tags/ciencia /tags/science;
/tags/cine /tags/movies;
/tags/pitagoras /tags/math;
/tags/fin-de-semana /tags/weekends;
/tags/gobierno /tags/government;
/tags/robotica /tags/robotics;
/tags/seguridad /tags/security;
/tags/busquedas /tags/search;
/categories/noticias-informaticas /categories/it-news;
/categories/platicas-y-congresos /categories/talks-and-events;
/categories/programacion /categories/programming;
/categories/redes-sociales /categories/social-media;
/categories/tecnologia /categories/technology;
/categories/soluciones /categories/solutions;
/categories/tutoriales /categories/tutorials;
/categories/hola-mundo /categories/hello-world;
/categories/juegos /categories/gaming;
/categories/hacking-etico /categories/ethical-hacking;
/categories/eventos /categories/events;
/categories/noticias /categories/news;
/categories/ciclos-excesivos /categories/linux-debugging;
/categories/discos-duros /categories/storage;
/categories/ciencia /categories/science;
/categories/cine /categories/movies;
/categories/pitagoras /categories/math;
/categories/fin-de-semana /categories/weekends;
/categories/gobierno /categories/government;
/categories/robotica /categories/robotics;
/categories/robótica /categories/robotics;
/categories/seguridad /categories/security;
/categories/busquedas /categories/search;
# post title redirect
/2023/01/i-used-ai-to-successfully-migreate-my-website-infrastructure /2023/01/i-used-ai-to-successfully-migrate-my-website-infrastructure;
}
server {
listen 8080 default_server;
listen [::]:8080 default_server;
server_name _;
root /usr/share/nginx/html;
gzip on;
gzip_types text/css application/javascript application/json image/svg+xml;
gzip_comp_level 9;
etag on;
if ($new_uri) {
return 301 $new_uri;
}
location ~ ^/tag/(.*)$ {
return 301 /tags/$1;
}
location ~ ^/category/(.*)$ {
return 301 /categories/$1;
}
# regular rules
location / {
try_files $uri $uri/ /index.html;
}
location /images/ {
add_header Cache-Control max-age=31536000;
}
location /index.html {
add_header Cache-Control no-cache;
}
}
}