服務器配置
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參見