[root@centos01 ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@centos01 ~]# rm -rf /etc/yum.repos.d/CentOS-*[root@centos01 ~]# yum -y install pcre-devel zlib-devel[root@centos01 ~]# useradd -M -s /sbin/nologin nginx
[root@centos01 ~]# umount /mnt/[root@centos01 ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@centos01 ~]# ls /mnt/[root@centos01 ~]# tar zxf
/mnt/nginx-1.6.0.tar.gz -C /usr/src/
[root@centos01 nginx-1.6.0]# ./configure \
> --prefix=/usr/local/nginx \
> --user=nginx \
> --group=nginx \
> --with-http_stub_status_module[root@centos01 nginx-1.6.0]# make && make install[root@centos01 ~]# ln -s
/usr/local/nginx/sbin/* /usr/local/sbin/
[root@centos01 ~]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful[root@centos01 ~]# mkdir /www
[root@centos01 ~]# echo "www.stz.com" > /www/index.html[root@centos01 ~]# cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak
[root@centos01 ~]# vim /usr/local/nginx/conf/nginx.conf
user
nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
worker_connections 1024;
}
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name www.stz.com;
charset utf-8;
access_log www.stz.com.access.log;
location / {
root /www;
index index.html index.htm;
}
}
}[root@centos01 ~]# nginx
[root@centos01 ~]# netstat -anptu | grep nginx
tcp
0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3740/nginx: master[root@centos02 ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@centos02 ~]# ls /mnt/
CentOS_BuildTag images repodata
EFI isolinux RPM-GPG-KEY-CentOS-7
EULA LiveOS RPM-GPG-KEY-CentOS-Testing-7
GPL Packages TRANS.TBL[root@centos02 ~]# rpm -ivh /mnt/Packages/bind-9.9.4-50.el7.x86_64.rpm
[root@centos02 ~]# rpm -ivh /mnt/Packages/bind-chroot-9.9.4-50.el7.x86_64.rpm[root@centos02 ~]# systemctl start named
[root@centos02 ~]# systemctl enable named[root@centos02 ~]# vim /etc/named.conf
options {
listen-on port 53 { any; };
directory "/var/named";
};
zone "stz.com" IN {
type master;
file "/var/named/stz.com.zone";
};
zone "benet.com" IN {
type master;
file "/var/named/benet.com.zone";
};[root@centos02 ~]# named-checkconf /etc/named.conf[root@centos02 ~]# vim
/var/named/stz.com.zone
$TTL 86400
@ SOA stz.com. root.stz.com. (
2022021609
1H
15M
1W
1D
)
@ NS centos02.stz.com.
centos02 A 192.168.100.20
www A 192.168.100.10[root@centos02 ~]# vim
/var/named/benet.com.zone
$TTL 86400
@ SOA benet.com. root.benet.com. (
2022021609
1H
15M
1W
1D
)
@ NS centos02.benet.com.
centos02 A 192.168.100.20
www A 192.168.100.30[root@centos02 ~]# named-checkzone stz.com /var/named/stz.com.zone
zone stz.com/IN: loaded serial 2022021609
OK
[root@centos02 ~]# named-checkzone benet.com /var/named/benet.com.zone
zone benet.com/IN: loaded serial 2022021609
OK[root@centos02 ~]# systemctl start named
[root@centos02 ~]# systemctl enable named[root@centos02 ~]# netstat -anptu | grep named
tcp
0 0 127.0.0.1:53 0.0.0.0:* LISTEN 1449/named
tcp
0 0 127.0.0.1:953 0.0.0.0:* LISTEN 1449/named
tcp6
0 0 ::1:53 :::* LISTEN 1449/named
tcp6
0 0 ::1:953 :::* LISTEN
1449/named
udp
0 0 127.0.0.1:53 0.0.0.0:* 1449/named
udp6
0 0 ::1:53 :::* 1449/named[root@centos02 ~]# nslookup www.stz.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: www.stz.com
Address: 192.168.100.10
[root@centos02 ~]# nslookup www.benet.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: www.benet.com
Address: 192.168.100.30[root@centos03 ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@centos03 ~]# rm -rf /etc/yum.repos.d/CentOS-*
[root@centos03 ~]# cat /etc/yum.repos.d/local.repo
[local]
name=centos
baseurl=file:///mnt
enabled=1
gpgcheck=0[root@centos03 ~]# yum -y install httpd php php-mysql mariadb-server[root@centos03 ~]# systemctl start httpd
[root@centos03 ~]# systemctl enable httpd
[root@centos03 ~]# systemctl start mariadb
[root@centos03 ~]# systemctl enable mariadb[root@centos03 ~]# vim /var/www/html/index.html
www.benet.com[root@centos03 ~]# vim /var/www/html/index.php
<?php
phpinfo();
?>
2)访问Nginx
3)访问LAMP平台
3)访问LAMP的php
[root@centos01 ~]# vim /usr/local/nginx/conf/nginx.conf
user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name www.stz.com;
charset utf-8;
access_log www.stz.com.access.log;
location ~ .*\.(gif|jpg|bmp|swf)$ {
root /www;
index index.html index.htm;
}
location ~ \.php$ {
proxy_pass http://www.benet.com;
}
}
}[root@centos01 ~]# nginx -t
nginx: the configuration file
/usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file
/usr/local/nginx/conf/nginx.conf test is successful[root@centos01 ~]# killall -I -QUIT nginx
[root@centos01 ~]# nginx[root@centos01 ~]# yum -y install pcre-devel zlib-devel
[root@centos01 ~]# useradd -M -s /sbin/nologin nginx[root@centos01 ~]# tar zxf ./nginx-1.12.0.tar.gz -C /usr/src/
[root@centos01 ~]# cd /usr/src/nginx-1.12.0/
[root@centos01 nginx-1.12.0]# ./configure \
> --prefix=/usr/local/nginx/ \
> --user=nginx \
> --group=nginx \
> --with-http_stub_status_module[root@centos01 nginx-1.12.0]# make && make install[root@centos01 nginx-1.12.0]# ln -s /usr/local/nginx/sbin/* /usr/local/sbin/[root@centos01 ~]# mkdir /www
[root@centos01 ~]# echo "www.stz.com" > /www/index.html[root@centos01 ~]# vim /usr/local/nginx/conf/nginx.conf
user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
worker_connections 1024;
}
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name www.stz.com;
charset utf-8;
access_log www.stz.com.access.log;
location / {
root /www;
index index.html index.htm;
}
}
}[root@centos01 ~]# nginx
[root@centos01 ~]# netstat -anptu | grep nginx
tcp
0 0 0.0.0.0:80 0.0.0.0:* LISTEN 47091/nginx: master
[root@centos01 ~]# ls
anaconda-ks.cfg nginx-1.16.1.tar.gz 视频 下载
initial-setup-ks.cfg 公共 图片 音乐
nginx-1.12.0.tar.gz 模板 文档 桌面
[root@centos01 ~]# tar -zxf ./nginx-1.16.1.tar.gz -C /usr/src/
[root@centos01 ~]# cd /usr/src/nginx-1.6.0/
[root@centos01 nginx-1.6.0]# ./configure \
> --user=nginx \
> --group=nginx \
> --with-http_stub_status_module[root@centos01 nginx-1.6.0]# make[root@centos01 nginx-1.6.0]# killall -I -QUIT nginx[root@centos01 nginx-1.6.0]# cp objs/nginx /usr/local/sbin[root@centos01 ~]# nginx -V
nginx version: nginx/1.6.0
built by gcc 4.8.5 20150623 (Red Hat
4.8.5-16) (GCC)
configure arguments: --user=nginx
--group=nginx --with-http_stub_status_module[root@centos01 ~]# nginx
[root@centos01 ~]# netstat -anptu | grep nginx
tcp
0 0 0.0.0.0:80 0.0.0.0:* LISTEN 49485/nginx: master
[root@centos01 ~]# rpm -ivh /mnt/Packages/httpd-tools-2.4.6-67.el7.centos.x86_64.rpm[root@centos01 ~]# htpasswd -c /usr/local/nginx/password bob
New password:
Re-type new password:
Adding password for user bob[root@centos01 ~]# vim
/usr/local/nginx/conf/nginx.conf
user nobody;
worker_processes 1;
events {
worker_connections 1024;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name www.stz.com;
charset utf-8;
access_log www.stz.com.access.log;
location / {
root /www;
index index.html index.htm;
}
location /status {
stub_status on;
access_log off;
auth_basic "welcom tomauth";
auth_basic_user_file /usr/local/nginx/password;
}
}
}[root@centos01 ~]# killall -I -QUIT nginx
[root@centos01 ~]# nginx
6)查看监控
尝试通过RVM将RubyGems升级到版本1.8.10并出现此错误:$rvmrubygemslatestRemovingoldRubygemsfiles...Installingrubygems-1.8.10forruby-1.9.2-p180...ERROR:Errorrunning'GEM_PATH="/Users/foo/.rvm/gems/ruby-1.9.2-p180:/Users/foo/.rvm/gems/ruby-1.9.2-p180@global:/Users/foo/.rvm/gems/ruby-1.9.2-p180:/Users/foo/.rvm/gems/rub
我的瘦服务器配置了nginx,我的ROR应用程序正在它们上运行。在我发布代码更新时运行thinrestart会给我的应用程序带来一些停机时间。我试图弄清楚如何优雅地重启正在运行的Thin实例,但找不到好的解决方案。有没有人能做到这一点? 最佳答案 #Restartjustthethinserverdescribedbythatconfigsudothin-C/etc/thin/mysite.ymlrestartNginx将继续运行并代理请求。如果您将Nginx设置为使用多个上游服务器,例如server{listen80;server
我在我的Rails项目中使用Pow和powifygem。现在我尝试升级我的ruby版本(从1.9.3到2.0.0,我使用RVM)当我切换ruby版本、安装所有gem依赖项时,我通过运行railss并访问localhost:3000确保该应用程序正常运行以前,我通过使用pow访问http://my_app.dev来浏览我的应用程序。升级后,由于错误Bundler::RubyVersionMismatch:YourRubyversionis1.9.3,butyourGemfilespecified2.0.0,此url不起作用我尝试过的:重新创建pow应用程序重启pow服务器更新战俘
我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121
我最近决定从我的系统中卸载RVM。在thispage提出的一些论点说服我:实际上,我的决定是,我根本不想担心Ruby的多个版本。我只想使用1.9.2-p290版本而不用担心其他任何事情。但是,当我在我的Mac上运行ruby--version时,它告诉我我的版本是1.8.7。我四处寻找如何简单地从我的Mac上卸载这个Ruby,但奇怪的是我没有找到任何东西。似乎唯一想卸载Ruby的人运行linux,而使用Mac的每个人都推荐RVM。如何从我的Mac上卸载Ruby1.8.7?我想升级到1.9.2-p290版本,并且我希望我的系统上只有一个版本。 最佳答案
我完全不是程序员,正在学习使用Ruby和Rails框架进行编程。我目前正在使用Ruby1.8.7和Rails3.0.3,但我想知道我是否应该升级到Ruby1.9,因为我真的没有任何升级的“遗留”成本。缺点是什么?我是否会遇到与普通gem的兼容性问题,或者甚至其他我不太了解甚至无法预料的问题? 最佳答案 你应该升级。不要坚持从1.8.7开始。如果您发现不支持1.9.2的gem,请避免使用它们(因为它们很可能不被维护)。如果您对gem是否兼容1.9.2有任何疑问,您可以在以下位置查看:http://www.railsplugins.or
A/ctohttp://wiki.nginx.org/CoreModule#usermaster进程曾经以root用户运行,是否可以以不同的用户运行nginxmaster进程? 最佳答案 只需以非root身份运行init脚本(即/etc/init.d/nginxstart),就可以用不同的用户运行nginxmaster进程。如果这真的是你想要做的,你将需要确保日志和pid目录(通常是/var/log/nginx&/var/run/nginx.pid)对该用户是可写的,并且您所有的listen调用都是针对大于1024的端口(因为绑定(
我们有一个目前在Rails2.3.12版和Ruby1.8.7版上运行的应用程序。我们想将我们的应用程序更新到Rails4.0和Ruby2.1.0。我们有大约200个模型和150个Controller。我想知道升级过程需要多大的努力。您还可以提供升级可以遵循的步骤。我们应该先升级Ruby然后再升级Rails还是相反? 最佳答案 您想要实现的目标将是史诗般的努力。我无法为您提供分步说明,因为不可能在一个答案中涵盖所有情况。我建议不要同时升级Ruby和Rails,而是分步升级。升级本身的复杂性是巨大的,但只要您的应用程序具有合理的测试覆盖
我最近尝试安装rails4.1.0.beta1,但是railss导致以下错误。[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4.1.0.beta1/lib/active_support/core_ext/module/aliasing.rb:32:in`alias_method':undefinedmethod`graft'forclass`ActiveRecord::Associations::JoinDependency'(NameError)[RVM]/gems/ruby-2.0.0-p247/gems/activesupport-4
我目前有一个运行在4.2.5上的Rails应用程序,我想使用ActionCable而不必将整个应用程序升级到Rails5.0.0.beta3版本并冒破坏所有其他gem的风险。按照我在互联网上看到的指南,我已经尝试过gem'actioncable',github:'rails/actioncable'这不起作用,因为ActionCable存储库已合并到Rails存储库中。我什至试过gem'actioncable',github:'rails/rails'但这似乎不适用于ActionCable合并到Rails时发生的版本重新编号。(唯一低于5.0.0.beta*的版本是0.0.0,这似乎是