首页 > 代码库 > 如何在远程Linux服务器上搭建Nginx

如何在远程Linux服务器上搭建Nginx

 

首先得申明一下使用的工具有: 

1. putty  https://pan.baidu.com/s/1i4Ix8Hn

 2. fileZilla  https://pan.baidu.com/s/1nvJR8al

 

如果是抢购阿里云免费的就按照下面执行下去就行了,如果花钱买的主机,会顺手送你一个Apache服务器,你的手动卸载Apache,卸载的步骤我会在下个博文中介绍,等不及的可以联系我hjjuny@163.com

 

下面先配置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