如何在遠程Linux服務器上搭建Nginx
首先得申明一下使用的工具有:
1. putty https://pan.baidu.com/s/1i4Ix8Hn
2. fileZilla https://pan.baidu.com/s/1nvJR8al
如果是搶購阿裏雲免費的就按照下面執行下去就行了,如果花錢買的主機,會順手送你一個Apache服務器,你的手動卸載Apache,卸載的步驟我會在下個博文中介紹,[email protected]
下面先配置Nginx
yum install epel-release -y
yum install https://centos7.iuscommunity.org/ius-release.rpm -y
yum install pcre pcre-devel
yum install zlib zlib-devel
yum install gcc gcc-c++
yum install openssl openssl-devel
yum install libxml2 libxml2-devel
yum install curl curl-devel
cd /usr/local/src/
wget http://nginx.org/download/nginx-1.10.3.tar.gz
tar -zxvf nginx-1.10.3.tar.gz
cd nginx-1.10.3
./configure --prefix=/usr/local/nginx
make
make install
/usr/local/nginx/sbin/nginx
yum install mysql mysql-server –y
service mysqld start
然後配置PHP環境
cd /usr/local/src
wget http://cn2.php.net/get/php-5.6.24.tar.gz/from/this/mirror
mv mirror php-5.6.24.tar.gz
tar -zxvf php-5.6.24.tar.gz
cd php-5.6.24
./configure --prefix=/usr/local/php --enable-fpm --with-curl --with-zlib --with-openssl --with-iconv --with-pdo-mysql=mysqlnd --enable-soap
make
make test
make install
cp php.ini-development /usr/local/php/etc/php.ini
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf
vi /usr/local/nginx/conf/nginx.conf
cd /usr/local/src/php-5.6.24
cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod a+x /etc/init.d/php-fpm
/etc/init.d/php-fpm start
/usr/local/nginx/sbin/nginx -s reload
vi /usr/local/nginx/html/aa.php
配置用戶 (ftp服務軟件)
先執行兩步:
yum install vsftpd
service vsftpd start
在執行:
第一步:useradd -d /usr/local/html hjjtest
第二步(改密):passwd hjjtest
然後就是輸入新密碼
如何在遠程Linux服務器上搭建Nginx