Ubuntu 에 ROR 환경 및 passenger + nginx 설정 설치
\ # 자원 업데이트
1. $ sudo apt-get update
\ # 설치 에 필요 한 환경
2. $ sudo apt-get install -y wget vim build-essential openssl libreadline6 libreadline6-dev libmysqlclient-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev libcurl4-openssl-dev autoconf automake libtool imagemagick libmagickwand-dev libpcre3-dev nodejs libpq-dev
\ # rvm 설치
3. $ sudo su -
$ \curl -L https://get.rvm.io | bash -s stable
\ # 환경 변수 쓰기
4. $ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >>~/.bashrc
$ source ~/.bashrc
$ rvm -v # rvm ( )
\ # 국내 서버 라면 RVM 의 설치 원 을 Taobao 의 미 러 서버 로 교체 하 는 것 을 추천 합 니 다. 이렇게 설치 하면 더욱 빠 를 수 있 습 니 다!
5. $ sed -i -e 's/ftp\.ruby-lang\.org\/pub\/ruby/ruby\.taobao\.org\/mirrors\/ruby/g' /usr/local/rvm/config/db
\ # RVM 으로 Ruby 설치
6. $ rvm pkg install readline openssl ( , )
\ # 루비 설치
7. $ rvm install 2.0.0 ( 2.0.0 )
\ # 기본 루비 버 전 지정
8. $ rvm use 2.0.0 --default
\ # ruby 버 전 보기
9. $ ruby -v
\ # 미 러 교체
10. $ gem sources --remove https://rubygems.org/
$ gem sources -a http://ruby.taobao.org/
$ gem sources -l
결과 보기:
*** CURRENT SOURCES ***
http://ruby.taobao.org
\ # 레일 설치
11. $ gem install rails ( 4.0 gem install rails -v 3.2.13)
\ # 승객 설치
12. $ gem install passenger
$ passenger -v ( )
\ # nginx 설치
Passenger 는 Nginx 를 다시 컴 파일 해 야 하기 때문에 Nginx 가 설치 되 어 있 으 면 마 운 트 해제 해 야 합 니 다!
nginx - v, 있 으 면 $sudo apt - get remove nginx - common nginx - full nginx
13. $ sudo passenger-install-nginx-module
마지막 으로 볼 수 있 습 니 다: Nginx with Passenger support was successfully installed.
\ # nginx 자체 페이지 삭제
14. $ sudo rm -rf /opt/nginx/html/index.html
\ # Nginx 와 사이트 설정
15. $ sudo vim /opt/nginx/conf/nginx.conf
\ # 내 가 설정 한 demo
user shengshihui; # , /home/shengshihui/www
#user nobody;
worker_processes 4;
#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 {
passenger_root /usr/local/rvm/gems/ruby-2.0.0-p195/gems/passenger-4.0.20;
passenger_ruby /usr/local/rvm/wrappers/ruby-2.0.0-p195/ruby;
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;
client_max_body_size 500m;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
#gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary off;
gzip_disable "MSIE [1-6]\.";
server {
listen 80;
server_name localhost;
root /home/shengshihui/www/ror/dotshouji_server/public;
passenger_enabled on;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
\ # 다음은 Nginx 의 시작 스 크 립 트 를 설치 하고 자동 시작 설정 이 필요 합 니 다.
$ cd ~/
$ git clone git://github.com/jnstq/rails-nginx-passenger-ubuntu.git
$ sudo mv rails-nginx-passenger-ubuntu/nginx/nginx /etc/init.d/nginx
$ sudo chmod +x /etc/init.d/nginx
\ # Nginx 자동 시작 설정
$ sudo update-rc.d nginx defaults
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
간단! Certbot을 사용하여 웹 사이트를 SSL(HTTPS)화하는 방법초보자가 인프라 주위를 정돈하는 것은 매우 어렵습니다. 이번은 사이트를 간단하게 SSL화(HTTP에서 HTTPS통신)로 변경하는 방법을 소개합니다! 이번에는 소프트웨어 시스템 Nginx CentOS7 의 환경에서 S...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.