前置库安装
sudo apt-get install gcc
sudo apt-get install build-essential
sudo apt-get install gcc g++ build-essential libssl-dev libreadline5-dev zlib1g-dev linux-headers-generic
sudo apt-get install zlib1g-dev libssl-dev libreadline5-dev libxml2-dev
sudo apt-get install libcurl4-openssl-dev libssl-dev zlib1g-dev libreadline5-dev
sudo apt-get install curl git-core
sudo apt-get install bison build-essential zlib1g zlib1g-dev libssl-dev libreadline5-dev libxml2-dev subversion autoconf
安装RVM
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
sudo vi /home/mlzboy/.bashrc
将[ -z "$PS1" ] && return替换为 if [[ -n "$PS1" ]] ; then
在最后加上
fi # <= be sure to close the if at the end of the .bashrc.
# This is a good place to source rvm v v v
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
使用source ~/.bashrc 可使更改立刻生效,也可新打开终端
进行测试
rvm notes
type rvm | head -n1
result is :rvm is a function
安装ruby 1.9.2
rvm list
rvm install 1.9.2
在安装完rails1.9.2后,将它设为默认的 rvm 1.9.2 --default 安装passenger gem install passenger 安装nginx 备份旧的nginx可执行文件及目录特别是nginx.conf,并将原来运行的nginx进程停止,虽然书上说可以进行平滑升级。 查看原有nginx配置参数 strings /usr/local/nginx/sbin/nginx | grep configure --add-module=../uwsgi-0.9.5.4/nginx/ --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module
sudo
apt-get
install
libpcre3 libpcre3-dev
sudo apt-get install libcurl4-openssl-dev sudo apt-get install openssl libssl-devsudo apt-get install build-essential libpcre3-dev libssl-dev libxslt-dev libgd2-xpm-dev libgeoip-dev zlib1g-dev
wget http://nginx.org/download/nginx-0.7.67.tar.gz
tar xvf nginx-0.7.67.tar.gz
使用rvmsudo passenger-install-nginx-module进行升级安装nginx
根据提示:Please specify the directory: /home/mlzboy/nginx-0.7.67
Please specify a prefix directory [/opt/nginx]: /usr/local/nginx
Extra arguments to pass to configure script: --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module
完成后会提示两段话
Nginx with Passenger support was successfully installed.
Please edit your Nginx configuration file (probably /usr/local/nginx/conf/nginx.conf),
and set the passenger_root and passenger_ruby configuration options in the
'http' block, like this:
http {
...
passenger_root /home/mlzboy/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.1;
passenger_ruby /home/mlzboy/.rvm/wrappers/ruby-1.9.2-p0/ruby;
...
}
After you (re)start Nginx, you are ready to deploy any number of Ruby on Rails
applications on Nginx.
Deploying a Ruby on Rails application: an example
Suppose you have a Ruby on Rails application in /somewhere. Add a server block
to your Nginx configuration file, set its root to /somewhere/public, and set
'passenger_enabled on', like this:
server {
listen 80;
server_name www.yourhost.com;
root /somewhere/public; # <--- be sure to point to 'public'!
passenger_enabled on;
}
And that's it! You may also want to check the Users Guide for security and
optimization tips and other useful information:
/home/mlzboy/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.1/doc/Users guide Nginx.html
从目前的情况来看,如果原有nginx则nginx.conf不会被覆盖
sudo /usr/local/nginx/conf/nginx.conf
nginx.conf以下部分进行更改
在第1行
user mlzboy;
在http{...}节内
加入以下两行
passenger_root /home/mlzboy/.rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.1;
passenger_ruby /home/mlzboy/.rvm/wrappers/ruby-1.9.2-p0/ruby;
在server节加入如下,局部根据具体情况更改
server {
listen 80;
server_name localhost;
root /home/mlzboy/my/b2c2/public;
passenger_enabled on;
rails_env development;
保存后使用./sbin/nginx -t来检测配置的正确性
安装并配置mysql
sudo apt-get install mysql-server-5.1
sudo vi /etc/mysql/my.cnf
做以下更改以达到,能被外部访问,中国时区,utf-8支持,红色标记为改动部分
[client]
default-character-set=utf8
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
default-character-set=utf8
init_connect='SET NAMES utf8'
default-time-zone = '+8:00'
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
更改系统时区
sudo tzselect
sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
sudo ntpdate cn.pool.ntp.org
date
重启mysql服务
sudo service mysql restart
检查前面的设置
mysql -uroot -p
mysql> show variables like '%time_zone%';
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | CST |
| time_zone | +08:00 |
+------------------+--------+
2 rows in set (0.00 sec)
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2010-12-10 22:22:26 |
+---------------------+
1 row in set (0.00 sec)
mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
使外网特定ip能访问远程mysql,还需要进行以下配置
二、Mysql数据库的修改
1) [root@etc etc]# mysql -u root -p
Enter password:
2)mysql> use mysql;
3)mysql> select host,user,password from user;
4)grant all privileges on *.* to root@192.168.1.100 identified by 'password'
注意: (1)192.168.15.101是欲连接到此Mysql数据库的客户端的IP地址,而不是Mysql数据库所在数据库服务器的IP地址,切记
(2)password就是Mysql数据库root用户的password,根据实际情况需要修改
上传程序及mysql数据脚本备份
将数据导入mysql,生产库和开发库使用一模一样的配置
mysql -uroot -pxxxx <2010-12-11进行备份数据导入,相应的导出脚本为mysqldump --database b2c2_development -uroot -pxxxx >20101210
使用cron作每日备份
bachup_mysql.sh
#!/bin/sh
name=$(date +%Y-%m-%d)
/usr/bin/mysqldump --database b2c2_development -uroot -pzhoubt | /bin/gzip>/home/mlzboy/my/backup_mysql/$name.gz
安装bundler及程序相关的依赖项
gem install bundler(注意是bundler,不是bundle)
sudo apt-get install imagemagick
paperclip插件需要这个库预先装,一般情况下已经装了
安装rails3的mysql2 gem需要sudo apt-get install libmysql-ruby libmysqlclient-dev
安装sqlite3-rubygem需要下面这个库的支持sudo apt-get install libsqlite3-dev
进入b2c2项目使用bundle install进行安装
passenger集成文档
http://rvm.beginrescueend.com/integration/passenger/
http://xcell.me/posts/3-installing-rails-3-through-rvm
http://thoughtrails.com/episodes/4-deployment-of-production-enviroment-ruby-1-9-2-rails-3-nginx-passenger-and-postgresql-with-rvm
http://ivice.iteye.com/blog/756391
http://rvm.beginrescueend.com/integration/passenger/
http://ivice.iteye.com/blog/730795
分享到:
相关推荐
1、基于vue+python+flask+uwsgi+nginx+mysql的外包项目网站项目源码.zip 2、该资源包括项目的全部源码,下载可以直接使用! 3、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目,作为...
《国产中标麒麟操作系统Nginx+Tomcat+Redis集群安装部署手册》是针对在中标麒麟操作系统上搭建Web服务环境的详细指南。这份手册由东软集团股份有限公司于2019年12月编撰,旨在解决在实际部署过程中可能出现的各种...
详细说明了windows服务器nginx+tomcat+mysql部署及配置(配置阿里云后台安全组,配置域名)很适合新手学习 附件中包含: 1.操作说明文档 2.操作录屏 3.安装所用到的软件安装包 1)Windows Server 2019 数据中心版 ...
国产中标麒麟操作系统nginx+tomcat+redis+mysql安装部署手册(CSDN).zip
### Web环境搭建:Linux+Nginx+PHP+MySQL+Redis #### 一、环境概述与推荐版本 在构建一个高效且稳定的商城系统时,选择合适的Web环境至关重要。本指南将介绍一套广泛应用于电商平台的技术栈——**Ubuntu + PHP + ...
这个压缩包包含了"keepalived+nginx+tomcat+redis+mysql"所需的基础组件,特别是Java Development Kit(JDK)。下面我们将详细探讨这些组件及其在IT领域的应用。 首先,JDK是Java编程语言的基石,它提供了编译、...
Nginx+Uwsgi+Django(python3)+Vue部署,一步步实现。网上找了N多篇文章都没成功,特意记录,以免其他同学踩坑
-vue+python+flask+uwsgi+nginx+mysql.zip毕业设计-外包项目网站 -vue+python+flask+uwsgi+nginx+mysql.zip毕业设计-外包项目网站 -vue+python+flask+uwsgi+nginx+mysql.zip毕业设计-外包项目网站 -vue+python+flask...
CentOS7 自动化搭建Nginx+PHP7+Mysql+Docker+Docker-Compose Shell脚本,Docker version 18.06.1-ce,docker-compose version 1.22.0
利用yum(黄狗)安装nginx,mysql,通过下载tomcat,jdk并安装。此处用mysql数据库(修改明文密码为复杂密码,不区分大小写设置)。设置tomcat,nginx相应的端口,路径等等。有需要即下载吧!
服务器方面,准备四台服务器,分别作为调度器(Nginx+Keepalived)、服务器池(Tomcat)、数据库服务器(Mysql)和客户端。在软件方面,需要准备Nginx、Keepalived、Tomcat、Mysql和jdk安装包,以及SL会员商城项目...
本指南将指导您如何安装和配置 Linux+Nginx+PHP+MySQL 环境,以便于构建一个功能完善的 Web 服务器。 安装 Red Hat Linux 在开始安装 Linux 之前,需要选择语言和键盘布局。然后,选择基本存储设备,重新初始化...
### Linux+Nginx+Mysql+Php安装教程 #### Linux 安装步骤详解 ##### 1. 开始安装过程 - **选择安装类型**:在安装初始界面选择 "Install or upgrade an existing system",系统将自动运行后续安装流程。 ##### 2...
2. **安装Nginx**:使用yum命令安装Nginx,执行`sudo yum install nginx`。 3. **安装PHP**:CentOS 7通常使用Remi仓库来安装最新版本的PHP,先安装Remi仓库`sudo yum install ...
### Django项目部署详解:使用Nginx + Gunicorn + Virtualenv + MySQL #### 一、概述 Django作为一款流行的Python Web框架,被广泛应用于Web应用的开发之中。随着技术的发展,为了确保项目的稳定性和安全性,通常...
在RHEL(Red Hat Enterprise Linux)系统上搭建Ruby on Rails(简称RoR)应用程序环境是一项技术性较强的任务,尤其当涉及到与其他服务如Nginx、Phusion Passenger、Ruby、Rails以及Oracle数据库集成时。以下是对这...
在构建高性能、高可用性的Web服务环境中,"负载均衡nginx+tomcat+terracotta+nfs+mysql"是一个常见的架构组合。这个组合充分利用了各组件的优势,以实现数据的高效处理、分布式存储以及会话共享,确保系统的稳定性和...
Win+Nginx+PHP+MySQL 环境搭建是指在 Windows 操作系统上安装和配置 Nginx、PHP、MySQL 等组件,以便搭建一个完整的 Web 服务器环境。该环境搭建主要涉及到 Nginx、PHP、MySQL 三个组件的安装和配置。 一、Nginx ...