我使用以下命令
在Ngenix上安装了PassengerHarshas-MacBook-Pro:~harshamv $ brew安装nginx - 带乘客
运行命令后,我收到以下消息。
Harshas-MacBook-Pro:~ harshamv$ brew reinstall nginx --with-passenger
==> Reinstalling nginx with --with-passenger
==> Downloading http://nginx.org/download/nginx-1.6.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/nginx-1.6.0.tar.gz
==> ./configure --prefix=/usr/local/Cellar/nginx/1.6.0_1 --with-http_ssl_module --with-pcre --with-ipv6 --sbin-path=/usr/local/Cellar/nginx/1.6.0_1/bin/nginx --with-cc-opt=-I/usr/local/Cellar/pcre/8.35/
==> make
==> make install
==> Caveats
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
To activate Phusion Passenger, add this to /usr/local/etc/nginx/nginx.conf:
passenger_root /usr/local/opt/passenger/libexec/lib/phusion_passenger/locations.ini
passenger_ruby /usr/bin/ruby
To reload nginx after an upgrade:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall nginx`
==> Summary
/usr/local/Cellar/nginx/1.6.0_1: 9 files, 3.1M, built in 13 seconds
运行安装后我得到了这个
Harshas-MacBook-Pro:~ harshamv$ brew postinstall nginx
Error: Not a directory - (/usr/local/Cellar/nginx/1.6.0_1/html, /usr/local/var/www)
Harshas-MacBook-Pro:~ harshamv$
我在ngnix.conf中添加了两行,如下所示,我收到以下错误。
Harshas-MacBook-Pro:~ harshamv$ nginx
nginx: [emerg] unexpected end of file, expecting ";" or "}" in /usr/local/etc/nginx/nginx.conf:122
ngnix.conf
#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;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index 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;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
passenger_root /usr/local/opt/passenger/libexec/lib/phusion_passenger/locations.ini
passenger_ruby /usr/bin/ruby
如何解决错误并使用Ngnix安装Passenger
答案 0 :(得分:1)
passenger_root和passenger_ruby必须放在http
上下文中,而不是主要上下文中。此外,它们必须以分号结束。请参阅文档: