80端口不能使用!

1: 新一rails项目配置nginx如下:

server {
listen 80;
server_name gui;
root /opt/dev/gui/public; # <--- be sure to point to 'public'!

client_max_body_size 10M;

passenger_enabled on;

passenger_use_global_queue on;
rails_env devlopment;

access_log   /opt/dev/gui/log/nginx.access.log ;
error_log    /opt/dev/gui/log/nginx.error.log ;


# disable site via capistrano (cap deploy:web:disable)
if (-f $document_root/system/maintenance.html) {
    rewrite ^(.*)$ /system/maintenance.html break;
}

error_page 500 502 503 504 /500.html;

# expires headers, takes advantage of the Rails asset_tag helpers:
location ~* ^.+\.(ico)(\?[0-9]+)?$ {
    passenger_enabled off;
    expires max;
}

}

2: nginx -s reload

3: 浏览器中输入:http://gui 怎么进不了我的应用呢

2 个回答

输入 http://gui , 需要浏览器先把域名gui解析为IP, 但gui不是国际标准域名,所以打不开。
试试 输入 http://127.0.0.1/http://127.0.0.1:80/ 应该就能访问了。

server_name配置成gui不是指你就能用http://gui来访问的,要想实现这样的效果可以用Pow.
Pow

Pow is a zero-config Rack server for Mac OS X. Have it serving your apps locally in under a minute.

Pow

你的回答