命令
brew update
brew install nginx
目录
html
文件在/opt/homebrew/Cellar/nginx
nginx.conf
在/opt/homebrew/etc/nginx
配置
修改端口,修改位置
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server {
#根据需要配置端口
listen 9000;
server_name localhost;
location / {
#前端文件位置,默认进入文件login.html
root html;
index login.html login.htm;
#error_page 405 =200 $uri;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
include servers/*;
}