I have been learning rails for a while, and I have also made several small projects. I encountered some minor troubles during the release. I am used to the graphical operations of windows, and it hurts my brains when I configure nginx. 1. Install mongrel: Gem install mongrel gem install mongrel_cluster
2. FirstClick hereDownload nginx and install:Directly decompress on the line, such as (c: \ nginx-0.8.39)3. Configure nginx:The path for installing nginx is: C: \ nginx-0.8.39 open: C: \ nginx-0.8.39 \ nginx \ conf \ nginx. 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; upstream mongrel {server 127.0.0.1: 3000;} server {Listen 80; SERVER_NAME localhost; charset UTF-8; # access_log logs/host. access. log main; Location/{root E: \ Xing \ public; index index.html index.htm; proxy_pass http: // mongrel; proxy_redirect off; proxy_set_header host $ Ho St; proxy_set_header X-real-IP $ remote_addr; proxy_set_header X-forwarded-for $ proxy_add_x_forwarded_for;} # error_page 404/404 .html; # redirect server error pages to the static page/50x.html # error_page 500 502 503 504/50 x.html; location =/50x.html {root HTML ;}# 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; # SERVER_NAME localhost; # SSL on; # ssl_certificate cert. PEM; # ssl_certificate_key cert. key; # ssl_session_timeout 5 m; # ssl_protocols SSLv2 SSLv3 tlsv1; # ssl_ciphers all :! ADH :! Export56: RC4 + RSA: + high: + medium: + low: + SSLv2: + exp; # ssl_prefer_server_ciphers on; # location/{# Root HTML; # index index.html index.htm; #}#}}
4. Configure mongrel :
My project is in the E: \ rails directory # mongrel_rails cluster: Configure-e development-P 8000-N 3 \-c e:/rails-A 127.0.0.1 Note:-e specifies environment. -P port. -N mongrel service process count The mongrel_cluster.yml file is generated in E: \ rails \ config \. The file content is :---
Address: 127.0.0.1
LOG_FILE: log/mongrel. Log
Port: "3000"
CWD: e: \ rails
Environment: Development
Pid_file: TMP/PIDs/mongrel. PID
Servers: 1 5. Command Mongrel_rails cluster: Start Start a mongrel Cluster
6. Start nginx
Nginx . Exe-C conf \ Nginx . Conf to end nginx command: taskkill/f/IM Nginx . EXE> NUL is not unexpected. It should be okay to enable http: // localhost /.