sudo apt install nginx -y
sudo vim /etc/nginx/sites-available/cms_nginx
server { listen 80; location / { proxy_pass http://localhost:8888; } location /admin/ { rewrite ^/admin/(.*) /$1 break; proxy_pass http://localhost:8889; } location /ranking/ { rewrite ^/ranking/(.*) /$1 break; proxy_pass http://localhost:8890; } }
sudo ln -s /etc/nginx/sites-available/cms_nginx /etc/nginx/sites-enabled/
sudo nginx -t
sudo service nginx restart
在/etc/nginx/nginx.conf檔案中找到http段落,加入以下限制
/etc/nginx/nginx.conf
client_max_body_size 100m;
server { listen 8080; root /var/www/html; index index.html; location / { try_files $uri $uri/ =404; } }
如果要改 root directory 的位置,要確保該路徑中的每個資料夾都有+x權限,像是
+x
root /home/contest/website;
要有
sudo chmod +x /home sudo chmod +x /home/contest
possible path of configuration file /usr/local/etc/nginx/nginx.conf /etc/nginx/nginx.conf
/usr/local/etc/nginx/nginx.conf
events { worker_connections 1024; } http { server { listen 80; server_name erichung.sa; location / { proxy_pass http://localhost:8000; } } }
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up