tar -zxvf nginx-1.12.2.tar.gz -C /opt
yum install -y gcc gcc-c++ pcre-devel zlib-devel
useradd -M -s /sbin/nologin nginx
cd /opt/nginx-1.12.2/
./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_stub_status_module
make && make install
ln -s /usr/local/nginx/sbin/* /usr/local/sbin/
vim /lib/systemd/system/nginx.service
chmod 754 /lib/systemd/system/nginx.service //授权
systemctl start nginx.service
systemctl stop firewalld.service
setenforce 0
netstat -ntap |grep 80
tar -zxvf mysql-boost-5.7.20.tar.gz -C /opt
yum install -y \
cmake \
ncurses \
ncurses-devel \
bison
useradd -s /sbin/nologin mysql
cd /opt/mysql-5.7.20/
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DSYSTEMD_PID_DIR=/usr/local/mysql \
-DSYSCONFDIR=/etc \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_BOOST=boost \
-DWITH_SYSTEMD=1
chown -R mysql.mysql /usr/local/mysql/
vim /etc/my.cnf
[client]
port = 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock
[mysql]
port = 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock
[mysqld]
user = mysql
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
character_set_server=utf8
pid-file = /usr/local/mysql/mysql.pid
socket = /usr/local/mysql/mysql.sock
server-id = 1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES
echo 'PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' >> /etc/profile
echo 'export PATH' >> /etc/profile
source /etc/profile
cd /usr/local/mysql/
bin/mysqld \
--initialize-insecure \
--user=mysql \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data
cp usr/lib/systemd/system/mysqld.service /lib/systemd/system/ //设置启动脚本
systemctl start mysqld.service
systemctl enable mysqld.service
mysqladmin -u root -p password
回车输入新的密码
mysql -uroot -p
tar -jxvf php-7.1.10.tar.bz2 -C /opt
yum install -y \
libjpeg libjpeg-devel \
libpng libpng-devel \
freetype freetype-devel \
libxml2 libxml2-devel \
zlib zlib-devel \
curl curl-devel \
openssl openssl-devel
cd /opt/php-7.1.10/
./configure \
--prefix=/usr/local/php \
--with-mysql-sock=/usr/local/mysql/mysql.sock \
--with-mysqli \
--with-zlib \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-openssl \
--enable-fpm \
--enable-mbstring \
--enable-xml \
--enable-session \
--enable-ftp \
--enable-pdo \
--enable-tokenizer \
--enable-zip
make && make install
cp php.ini-development /usr/local/php/lib/php.ini
vim /usr/local/php/lib/php.ini
/usr/local/php/bin/php -m //验证安装模块
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf
vim php-fpm.conf
pid = run/php-fpm.pid //去掉";"注释符号
cd php-fpm.d/
cp www.conf.default www.conf
/usr/local/php/sbin/php-fpm -c /usr/local/php/lib/php.ini
ln -s /usr/local/php/bin/* /usr/local/bin/ //建立软链接优化
cd /usr/local/nginx/conf
vim nginx.conf
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
cd /usr/local/nginx/html/
mv index.html index.php
vim index.php
systemctl stop nginx
systemctl start nginx
输入http://192.168.18.135/index.php即可访问
CREATE DATABASE bbs;
GRANT ALL ON bbs.* TO 'bbsuser'@'%' IDENTIFIED BY 'admin123';
GRANT ALL ON bbs.* TO 'bbsuser'@'localhost' IDENTIFIED BY 'admin123';
FLUSH PRIVILEGES;
unzip Discuz_X2.5_SC_UTF8.zip -d /opt/dis
cp -r /opt/dis/dir_SC_UTF8/upload /usr/local/nginx/html/bbs
cd /usr/local/nginx/html/bbs
chown -R root.nginx ./config/
chown -R root.nginx ./data/
chown -R root.nginx ./uc_client/
chown -R root.nginx ./uc_server/
chmod -R 777 ./config/
chmod -R 777 ./data/
chmod -R 777 ./uc_client/
chmod -R 777 ./uc_server/
安装完成之后输入192.168.18.135/index.php
Tips:在虚拟机安装mysql-boost时,一定要内存最好为4G。