【发布时间】:2016-06-25 16:32:00
【问题描述】:
【问题讨论】:
【问题讨论】:
我只是试了一下,我遇到了同样的错误。我还没有完全弄清楚。但与此同时,我发现这个解决方案让我知道是否适合你。
首先我安装了 Brew (http://brew.sh/index_es.html)
在终端上复制粘贴
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
运行完成后,您可以验证其是否安装
brew -v
然后用 Brew 安装 nginx
brew install nginx
运行完成后,您可以验证其是否安装
nginx -v
现在一切都应该正常了。现在几个配置。你去你机器的根文件夹寻找/usr/local/etc/nginx/nginx.conf用文本编辑器打开它,你会得到这样的东西:
(您只需更改项目的端口和 url 两件事)
user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 8080; #CHANGE TO 80
server_name localhost;
#charset koi8-r;
#access_log logs/access.log main;
location / {
root /Users/Mario/Sites/proyName; #URL of the project
}
不要更改任何其他内容。
之后运行
sudo nginx
如果需要停止运行
sudo nginx -s stop
你的项目的 URL 应该是http://localhost
希望对你有帮助
【讨论】: