? ? ? 相关文章:MacOS M1安装Homebrew
1、安装Nginx
#安装
brew install nginx
#开启
sudo nginx
? ? ? 此时浏览器访问?http://localhost:8080/?如下,Nginx安装成功:
? ? ? ?Nginx的默认配置文件在?/opt/homebrew/etc/nginx/nginx.conf,把默认端口改为80,如下:
??
#user nobody;
worker_processes auto;
error_log /opt/homebrew/var/log/nginx/error.log crit;
#pid logs/nginx.pid;
events {
use epoll;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /opt/homebrew/var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
#access_log logs/host.access.log main;
location / {
root html;
index index.php index.html index.htm;
}
#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;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# nginx配置pathifo
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
include servers/*;
}
|