美文网首页
mac下部署nginx

mac下部署nginx

作者: 大华随写 | 来源:发表于2019-04-23 11:00 被阅读0次

安装

1、打开终端

2、安装Command Line tools

xcode-select --install

3、安装brew命令

1ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

4、安装nginx

1brew install nginx

5、启动nginx

1sudo nginx

配置

要是8080端口被占用了,可以在配置文件中更改:

配置文件如下路径:

/usr/local/etc/nginx/nginx.conf

server {

        listen      9090;

        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

在location中修改运行的网站的目录

location / {

            root  /Users/Documents/nginx/html;

            index  index.html index.htm;

        }

访问

在127.0.0.1:9090中访问,要是遇到403错误如下解决:

 user root owner即可解决

相关文章

网友评论

      本文标题:mac下部署nginx

      本文链接:https://www.haomeiwen.com/subject/bzgmgqtx.html