#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 { #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #log_format upstreamlog '[$time_local] $remote_addr - $remote_user - $server_name to: $upstream_addr: $request upstream_response_time $upstream_response_time msec $msec request_time $request_time'; log_format main '$status - $proxy_host "$request" $upstream_addr'; server { access_log logs/access.log main; listen 80; location / { proxy_pass http://127.0.0.1:5000; proxy_read_timeout 9999; } location /api/fi/aa/v1.0/ { proxy_pass http://127.0.0.1:8080; proxy_read_timeout 9999; } location /api/fastdweb/runtime/v1.0/ { proxy_pass http://127.0.0.1:8080; proxy_read_timeout 9999; } } }
[Unit] Description=The NGINX HTTP and reverse proxy server After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/run/nginx.pid ExecStartPre=/usr/sbin/nginx -t ExecStart=/usr/sbin/nginx ExecReload=/usr/sbin/nginx -s reload ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
参考:
https://www.nginx.com/resources/wiki/start/topics/examples/systemd/