为什么使用的nginx相关的命令的时候必须加sudo
下面是我的配置文件,是使用brew安装的nginx,很疑惑的是如果不加sudo,可以访问localhost:8080,但是不能访问www.distributed-limiter.com,会显示DNS解析异常。感觉如果sudo会影响nginx的话,那8080也应该不能访问才对,难道nginx还会去对/etc/hosts有什么操作么才会用sudo
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#gzip on;
server {
listen 8080;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
limit_req_zone $binary_remote_addr zone=iplimit:20m rate=1r/s;
server {
server_name www.distributed-limiter.com;
location /access-limit/ {
proxy_pass http://127.0.0.1:8081/;
limit_req zone=iplimit burst=2 nodelay;
}
}
include servers/*;
}23
收起
正在回答 回答被采纳积分+1
1回答
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星