目录
七,通过systemctl命令能否正常启动,停止,重启nginx服务
- 1,安装Nginx服务
- 2,安装Mysql服务
- 3,安装配置PHP解析环境
- 4,部署Discuz! 社区论坛Web应用
1,关闭防火墙和安全机制
2,安装环境依赖包,并且创建程序用户
Nginx 的配置及运行需要 pcre、zlib 等软件包的支持,因此应预先安装这些软件的开发 包(devel),以便提供相应的库和头文件,确保 Nginx 的安装顺利完成
3,编译安装nginx
cd nginx-1.12.0/./configure \--prefix=/usr/local/nginx \#指定nginx的安装路径--user=nginx \#指定用户名--group=nginx \#指定组名--with-http_stub_status_module#启用 http_stub_status_module 模块以支持状态统计make && make installln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/#让系统识别nginx的操作命令
4,路径优化
为了使 Nginx 服务器的运行更加方便,可以为主程序 nginx 创建链接文件,以便管理员 直接执行“nginx”命令就可以调用 Nginx 的主程序(让系统可以识别
5,启动,停止nginx服务
nginx -t 检查配置文件是否配置正确nginx 启动停止nginx服务(控制手段)[root@kya conf]#cat /usr/local/nginx/logs/nginx.pid 8924kill -3 pid号kill -s quit pid号killall -3 nginxkillall -s qult nginx重载优雅的杀死,停止 kill systemctl stop暴力终止 rm -rf nginx.pid 强行关机断电
6,添加nginx系统服务
##配置参数解释##[Unit]Description=nginx ####描述After=network.target ####描述服务类别[Service]Type=forking ###后台运行形式PIDFile=/usr/local/nginx/logs/nginx.pid ###PID文件位置ExecStart=/usr/local/nginx/sbin/nginx ###启动服务ExecReload=/usr/bin/kill -s HUP $MAINPID ###根据PID重载配置ExecStop=/usr/bin/kill -s QUIT $MAINPID ###根据PID终止进程PrivateTmp=true[Install]WantedBy=multi-user.target
七,通过systemctl命令能否正常启动,停止,重启nginx服务
进入nginx访问界面
一,安装MySQL 环境依赖包
yum -y install \ncurses \ncurses-devel \bison \cmakeyum -y install \gd \libjpeg libjpeg-devel \libpng libpng-devel \freetype freetype-devel \libxml2 libxml2-devel \zlib zlib-devel \curl curl-devel \openssl openssl-devel
二,创建运行用户
三,编译安装mysql
cmake \-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \-DSYSCONFDIR=/etc \-DSYSTEMD_PID_DIR=/usr/local/mysql \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_ARCHIVE_STORAGE_ENGINE=1 \-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \-DMYSQL_DATADIR=/usr/local/mysql/data \-DWITH_BOOST=boost \-DWITH_SYSTEMD=1
[root@kya mysql-5.7.20]#
[root@kya mysql-5.7.20]#
[root@kya mysql-5.7.20]#make && make install
四,数据库目录进行权限调整
五,修改MySQL配置文件
vim /etc/my.cnf[client]port = 3306socket=/usr/local/mysql/mysql.sock[mysqld]user = mysqlbasedir=/usr/local/mysqldatadir=/usr/local/mysql/dataport = 3306character-set-server=utf8pid-file = /usr/local/mysql/mysqld.pidsocket=/usr/local/mysql/mysql.sockbind-address = 0.0.0.0skip-name-resolvemax_connections=2048default-storage-engine=INNODBmax_allowed_packet=16Mserver-id = 1sql_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
六更改mysql安装目录和配置文件的属主属组
chown -R mysql:mysql /usr/local/mysql/chown mysql:mysql /etc/my.cnf
七,设置路径的环境变量
echo 'export PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' >> /etc/profilesource /etc/profile
八,初始化数据库
cd /usr/local/mysql/bin/./mysqld \--initialize-insecure \--user=mysql \--basedir=/usr/local/mysql \--datadir=/usr/local/mysql/data
九 添加MySQL系统服务
cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/systemctl daemon-reloadsystemctl start mysqld.servicesystemctl enable mysqld
十,修改MySQL的登录密码
mysqladmin -u root -p password "123456"
mysql -u root -p ##这个命令敲下,提示要输入密码,这个就是刚才设置的密码123456
进入
1,安装环境依赖包
yum -y install gd \libjpeg libjpeg-devel \libpng libpng-devel \freetype freetype-devel \libxml2 libxml2-devel \zlib zlib-devel \curl curl-devel \openssl openssl-devel
2,编译安装
#=====解压安装包===========cd /opttar xjvf php-7.1.24.tar。bz2#=========检查环境,设置安装模块==========./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
3,路径优化
#将bin和sbin下面所有执行程序添加到环境变量中ln -s /usr/local/php/bin/* /usr/local/bin/ln -s /usr/local/php/sbin/* /usr/local/sbin/
4,调整主配置文件
php有三个配置文件: php.ini主配置文件 php-fpm.conf进程服务配置文件 www.conf扩展配置文件===========================================================#调整主配置文件:cp /opt/php-7.1.24/php.ini-development /usr/local/php/lib/php.inivim /usr/local/php/lib/php.ini--1170行--修改mysqli.default_socket = /usr/local/mysql/mysql.sock--939行--取消注释,修改date.timezone = Asia/Shanghaiphp -m #验证安装的模块#调整进程服务配置文件:cd /usr/local/php/etc/ cp php-fpm.conf.default php-fpm.confvim php-fpm.conf--17行--去掉";"注释pid = run/php-fpm.pid#调整扩展配置文件:cd /usr/local/php/etc/php-fpm.d/cp www.conf.default www.conf
5,调整主配置文件
6,调整进程配置文件
7,调整扩展配置
8, 启动php-fpm
9 配置nginx支持PHP解析
vim /usr/local/nginx/conf/nginx.conf--65行--取消注释,修改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;#将 /scripts 修改为nginx的工作目录 #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #$document_root 代表当前请求在root指令中指定的值include fastcgi_params;}systemctl restart nginx.service
在网页测试http://192.168.135.111/index.php
mysql -u root -pCREATE DATABASE bbs;GRANT all ON bbs.* TO 'bbsuser'@'%' IDENTIFIED BY 'admin123';GRANT all ON bbs.* TO 'bbsuser'@'localhost' IDENTIFIED BY 'admin123';flush privileges;vim /usr/local/nginx/html/index.php #替换原来的测试页内容
1,解压安装包并给予权限
cd /optunzip /opt/Discuz_X3.4_SC_UTF8.zip -d /tmp#上传站点更新包cd /opt/dis/dir_SC_UTF8/cp -r upload/ /usr/local/nginx/html/bbscd /usr/local/nginx/html/bbschmod -R 777 ./config/chmod -R 777 ./data/chmod -R 777 ./uc_*
cd /opt
unzip Discuz_X3.4_SC_UTF8.zip -d /tmp
cd /tmp/dir_SC_UTF8/
cp -r 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.135.111/bbs/install/index.php 进入,开始安装
来源地址:https://blog.csdn.net/m0_54594153/article/details/126485331