如何在Mac上搭建自己的服务器——Nginx

1.安装Homebrew

打开终端,输入:

[html] view plain copy
  1. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"  

 

跟着步骤走。终端都有提示。

2.依赖Homebrew安装Nginx

依旧在终端中

[html] view plain copy
  1. brew install nginx  

 

这个等待时间会比较长。如果你仔细看了终端的进程。你会发现你用homebrew安装是多么聪明了。其实在安装nginx之前还要帮你安装很多别的,如果你独立安装,是很费劲的。。。

3.启动Nginx

依旧在终端里,输入

[html] view plain copy
  1. nginx  

 

回车就行了。别惊讶,就这么简单。 
怎样验证Nginx能用了呢。你在浏览器里输入localhost:8080,回车,出现以下画面,说明成功。 
oscar

如果是以下画面,转身抬头挺胸三鞠躬,再回来看看那里出错了。 

posted @ 2018-05-04 19:06  琥珀君  阅读(379)  评论(0编辑  收藏  举报