1、安装LNMP
[root@localhost ~]# mount /dev/cdrom /mnt/
[root@localhost ~]# nginx
[root@localhost ~]# yum -y install mariadb-server mariadb-devel
[root@localhost ~]# yum -y install php php-mysql
[root@localhost ~]# cd lnmp_soft/
[root@localhost lnmp_soft ~]# rpm -ivh php-fpm-5.4.16-42.el7.x86_64.rpm
[root@localhost lnmp_soft ~]# systemctl start mariadb
[root@localhost lnmp_soft ~]# systemctl enable mariadb
[root@localhost lnmp_soft ~]# systemctl start php-fpm
[root@localhost lnmp_soft ~]# systemctl enable php-fpm
[root@localhost lnmp_soft]# netstat -anput | grep :3306
[root@localhost lnmp_soft]# netstat -anput | grep :9000
[root@localhost lnmp_soft]# mysql
[root@localhost lnmp_soft]# cd /usr/local/nginx/conf
[root@localhost conf]# vim nginx.conf
server {
listen 80;
server_name www.aa.com;
location / {
root html;
index index.html index.htm index.php;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}
}
2、测试PHP页面
[root@localhost conf]# nginx -s reload
[root@localhost conf]# cd /usr/local/nginx/html
[root@localhost html]# vim test.php
<?php
$i=33;
echo $i;
?>
[root@localhost html]# firefox www.aa.com/test.php
3、测试PHP链接MySQL页面
[root@localhost ~]# cp /root/lnmp_soft/php_scripts/mysql.php /usr/local/nginx/html/
[root@localhost ~]# firefox www.aa.com/mysql.php
4、开机启动网卡
[root@localhost ~]# nmcli connection modify ens33 connection.autoconnect yes
[root@localhost ~]# nmcli connection up ens33
[root@localhost ~]# ifconfig
5、下载、部署论坛
[root@localhost ~]# wget ftp://192.168.7.66/Discuz.zip
[root@localhost ~]# unzip Discuz.zip
[root@localhost ~]# cp -rf dir_SC_UTF8/upload/ /usr/local/nginx/html/bbs
[root@localhost ~]# cd /usr/local/nginx/html/
[root@localhost html]# chown apache -R bbs/
[root@localhost nginx]# setenforce 0
[root@localhost nginx]# vim /etc/sysconfig/selinux
...
SELINUX=permissive
...
[root@localhost nginx]# firefox www.aa.com/bbs