Ver Fonte

improve nginx config

nagadomi há 10 anos atrás
pai
commit
291a139ed8
1 ficheiros alterados com 13 adições e 4 exclusões
  1. 13 4
      appendix/waifu2x.nginx.conf

+ 13 - 4
appendix/waifu2x.nginx.conf

@@ -1,19 +1,28 @@
 upstream waifu2x {
         server localhost:8812;
 }
-
+map $http_accept_language $lang {
+  default en;
+  ~ja ja;
+  ~en en;
+}
 server {
-       server_name waifu2x.udp.jp;
+       # listen 80 default_server; 
+       server_name waifu2x.udp.jp; # fill your domain
        
-       access_log	/var/log/nginx/waifu2x.udp.jp.access.log;
+       access_log	/var/log/nginx/waifu2x.access.log;
        
        root   /home/ubuntu/waifu2x/assets;
+       try_files $uri $uri/index.$lang.html $uri/index.html @api;
 
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 
-       location / {
+       location ~ ^/(apple-touch-icon|browserconfig|favicon|mstile)(.*)\.(png|xml|ico)$ {
+          return 204;
+       }
+       location @api {
           proxy_pass http://waifu2x;
        }
 }