概述
#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;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'$request_uri '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
server {
listen 80;
server_name 10.3.17.172;
}
upstream grpcservers {
server 10.3.17.174:9999;
server 10.3.17.171:9999;
fair;
}
server {
listen 8899 http2;
server_name 10.3.17.172;
location / {
grpc_pass grpc://grpcservers;
error_page 502 = /error502grpc;
}
location = /error502grpc {
internal;
default_type application/grpc;
add_header grpc-status 14;
add_header grpc-message "unavailable";
return 204;
}
}
upstream doc4indexServers {
server 10.5.31.67:8010;
server 10.3.17.172:8010;
server 10.3.17.171:8010;
fair;
}
server {
listen 8011;
server_name 10.3.17.250;
location / {
root /usr/local/nginx/html2;
index index.html index.htm;
proxy_pass http://doc4indexServers;
}
}
}
重启:
sudo service nginx restart
或者
sudo pkill -f nginx
sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
最后
以上就是还单身黑米为你收集整理的nginx配置样例/重启的全部内容,希望文章能够帮你解决nginx配置样例/重启所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复