服务器配置
1.购买好vps后登录服务器首先修改密码passwd root
2.修改ssh的超时时间
代码如下3.安装setup
代码如下#安装setuptool
yum install setuptool
#可以发现执行setup后不全,再安装一个用于系统服务管理
yum install ntsysv
#再安装个防火墙,以及setup中配套的防火墙设置、网络设置
yum install iptables
#安装setup中配套的防火墙设置
yum install system-config-securitylevel-tui
#安装setup中配套的网络设置
yum install system-config-network-tui
4.格式化磁盘,挂载磁盘
客户端环境:Mac OSX
远程连接方式:运行 Terminal,输入命令 ssh username@ip
硬盘分区及挂载操作步骤:
1. 查看未挂载的硬盘(名称为/dev/xvdb)
代码如下5.首先安装gcc
6.安装nginx
代码如下二.安装nginx
代码如下官方网址:
wget
tar zxvf nginx-1.2.5.tar.gz
cd nginx-1.2.5/
./configure --user=www --group=www --prefix=http://www.3lian.com/web/server/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
cd ../
错误提示总结:
安装提示错误libpcre.so.1,则需要执行命令ln -s /usr/local/lib/libpcre.so.1 /lib64
如果没有安装pcre库,则在编译安装nginx的时候会提示./configure: error: the HTTP rewrite module requires the PCRE library.
如果提示错误nginx: [emerg] getpwnam("www") failed 则表示系统中没有www用户 用groupadd -f www useradd -g www www
如果提示错误./configure: error: SSL modules require the OpenSSL library. 则需要安装openssl
ssl官网地址:
wget
编译安装ssl后重新安装nginx
./configure --user=www --group=www --prefix=http://www.3lian.com/web/server/nginx --with-http_stub_status_module --with-openssl=http://www.3lian.com/usr/local/ssl
如果系统没有安装gcc,则需要先安装gcc. 命令yum install gcc*
其他错误:
编译Nginx提示gzip module requires the zlib library
新手在尝试安装nginx时,常常会因为缺少依赖组件,导致nginx相应模块无法安装,在执行“./configure”时常出现错误。
若在“./configure”后方加入了“--with-http_gzip_static_module”(添加gzip压缩模块)提示以下错误:
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using –without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using –with-zlib= option.
则需要安装“zlib-devel”即可。SSH执行以下命令:
yum install -y zlib-devel或者去官方网站下载zlib安装wget
7.安装mysql
代码如下8.安装php参见