首先要做的是就是关闭Centos7.4的防火墙及selinux
#systemctl stop firewalld
#systemctl disable firewalld
#sed -ri 's/^(SELINUX=).*/\1disabled/g' /etc/selinux/config
#setenforce 0 \\临时启用
#yum -y install make zlib zlib-devel gcc gcc-c++ libtool openssl openssl-devel autoconf
#wget http://mirrors.sohu.com/nginx/nginx-1.6.1.tar.gz
#tar -zxvf nginx-1.6.1.tar.gz
#cd /root/nginx-1.6.1
#./configure --prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/sbin/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--http-scgi-temp-path=/var/tmp/nginx/scg--with-pcre
预编译成功,会出现如下的提示信息:
#mkdir -p /var/tmp/nginx/client
#cd /root/nginx-1.6.1
#make && make install
编译安装完成没有报错,说明安装成功
#groupadd -r nginx #创建一个系统账户
#useradd -r -g nginx nginx #创建一个系统账户,所属组为nginx
[root@localhost ~]vim /usr/loca/nginx/nginx.conf
//添加 index.php:
location / {
root /usr/local/nginx/html;
index index.php index.html index.htm; (红色部分是需要添加的内容)
}
//修改:①、先去掉一下部分内容前面的注释“#”;②、将php-fpm所指的目录指向nginx的工作目录
location ~ \.php$ {
root /usr/local/nginx/html; (此路径是绝对路径,应该与 nginx 工作目录的路径一致)
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;
}
#/usr/local/nginx/sbin/nginx \\启动nginx服务
#/usr/local/nginx/sbin/nginx -s reload \\重新载入配置
#/usr/local/nginx/sbin/nginx -s reopen \\重启nginx服务
#/usr/local/nginx/sbin/nginx -s stop \\停止nginx服务
在浏览器的地址栏输入自己主机的IP地址:例如:192.168.1.1,就会出现如下界面
#yum install –y mariadb-server mariadb
#systemctl start mariadb
#systemctl enable mariadb
#mysql_secure_installation
或者
#mysqladmin –u root password ‘password’
#mysql -u root -p #输入密码
MariaDB [(none)]> create database wordpressdb;
MariaDB [(none)]> create user wordpress@localhost identified by '123456';
MariaDB [(none)]> grant all privileges on wordpressdb.* to wordpress@localhost;
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
#yum install -y mcrypt mhash libxml2-devel openssl-devel bzip2-devel curl-devel libmcrypt-devel readline-devel systemtap-sdt-devel libjpeg-devel libpng-devel freetype-devel
#wget http://mirrors.sohu.com/php/php-7.0.10.tar.gz
#tar -zxvf php-7.0.10.tar.gz
#cd php-7.0.10
./configure --prefix=/usr/local/php
--with-config-file-path=/usr/local/php/etc \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/usr/local/mysql/commondir/mysql.sock \
--with-libxml-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-iconv-dir \
--with-zlib-dir \
--enable-soap \
--enable-gd-native-ttf \
--enable-ftp \
--enable-mbstring \
--enable-exif \
--with-pear \
--with-curl \
--with-openssl
预编译出现以下提示信息,就预编译成功:
#cd /root/php-7.0.10
#make && make install
编译安装过程没有报错,代表安装成功
#cd /usr/local/php/etc
#mv php-fpm.conf.default php-fpm.conf
#vim php-fpm.conf
pid = run/php-fpm.pid #去掉前面的分号(;)
#cd /usr/local/php/php-fpm.d
#cp -a www.conf.default www.conf
#cd /root/php-7.0.10
#cp -a php.ini-production /usr/local/php/etc/php.ini
#cp -a sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
#chmod u+x /etc/init.d/php-fpm
#groupadd -r www #创建一个系统账户
#useradd -r -g www www #创建一个系统账户,所属组为www
#/etc/init.d/php-fpm start
#cd /usr/local/nginx/html/
#vim test.php
例如:192.168.1.1/test.php;就会看到如下的PHP测试首页
wget https://wordpress.org/latest.tar.gz
tar –zxvf latest.tar.gz
mv /root/wordpress/* /usr/local/nginx/html
#cd /usr/local/nginx/html
#mv wp-config-sample.php wp-config.php
#vim wp-config.php
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpressdb' ); \\数据库名
/** MySQL database username */
define( 'DB_USER', 'wordpress' ); \\数据用户名
/** MySQL database password */
define( 'DB_PASSWORD', '123456' ); \\数据库密码
#chown -R root:root /usr/local/nginx/html
扩展【 https://www.runoob.com/linux/nginx-install-setup.html 源码安装Nginx】
手机扫一扫
移动阅读更方便
你可能感兴趣的文章