這種方法能夠解決 可是每次開機啓動都要設置(筆者沒有寫腳本去處理) 太麻煩 因此本人採用第二種html
首先建立log文件java
touch /usr/local/etc/nginx/log/localhost.tomcat_access.log; touch /usr/local/etc/nginx/log/localhost.tomcat_error.log;
nginx配置目錄nginx
/usr/local/etc/nginx/nginx.conf
macos
#user nobody; 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; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; upstream localhost{ server 127.0.0.1:8080; } server { listen 80; server_name localhost; access_log log/localhost.tomcat_access.log; error_log log/localhost.tomcat_error.log; #charset koi8-r; #access_log logs/host.access.log main; location / { #root jsp; index index.html index.htm index.jsp; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://localhost; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } include servers/*; }