discuz 搭建(前提lnmp环境)

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:   效果图     32.lnmp 安装(Linux+Apache+MySQL+PHP) 32.1 apache 安装 wget http://mirrors.hust.edu.

 

效果图



 

 

32.lnmp 安装(Linux+Apache+MySQL+PHP)

32.1 apache 安装
wget http://mirrors.hust.edu.cn/apache//apr/apr-1.5.2.tar.gz
wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.5.4.tar.gz

wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.2.32.tar.gz


yum -y install pcre-devel

【No recognized SSL/TLS toolkit detected】
yum install openssl openssl-devel

./configure --prefix=/usr/local/apr 
make && make install

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install

./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-rewirte --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make && make install


vim /etc/httpd/httpd.conf    
在ServerRoot下面添加一行
PidFile "/var/run/httpd.pid"

vim /etc/init.d/httpd

#!/bin/bash
#
# httpd        Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.  It is used to serve \
#      HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid


# Source function library.
. /etc/rc.d/init.d/functions


if [ -f /etc/sysconfig/httpd ]; then
        . /etc/sysconfig/httpd
fi


# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}


# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""


# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.


# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache/bin/apachectl
httpd=${HTTPD-/usr/local/apache/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0


start() {
        echo -n $"Starting $prog: "
        LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile}
        return $RETVAL
}


stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d 10 $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
    echo -n $"Reloading $prog: "
    if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
        RETVAL=$?
        echo $"not reloading due to configuration syntax error"
        failure $"not reloading $httpd due to configuration syntax error"
    else
        killproc -p ${pidfile} $httpd -HUP
        RETVAL=$?
    fi
    echo
}


# See how we were called.
case "$1" in
  start)
start
;;
  stop)
stop
;;
  status)
        status -p ${pidfile} $httpd
RETVAL=$?
;;
  restart)
stop
start
;;
  condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
  reload)
        reload
;;
  graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
  *)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac


exit $RETVAL


为此脚本赋予执行权限: chmod +x /etc/rc.d/init.d/httpd
加入服务列表: chkconfig --add httpd
给3,5启动 chkconfig --level  3  httpd on            chkconfig --level  5 httpd on
最后加路径  export PATH=$PATH:/usr/local/apache/bin
vim /etc/profile.d/httpd.sh完成后重新登录就可以了

httpd -k start 
httpd -k stop

/usr/local/apache/bin/apachectl start


32.2 mysql 安装 centos7 yum安装mysql
32.2.1yum安装mysql
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum localinstall -y mysql57-community-release-el7-7.noarch.rpm
yum install -y mysql-community-server
systemctl start mysqld.service
grep 'temporary password' /var/log/mysqld.log  看见密码 
【 Your password does not satisfy the current policy requirements】
set global validate_password_policy=0;
【Your password does not satisfy the current policy requirements】
select @@validate_password_length;
set global validate_password_policy=0
SET PASSWORD = PASSWORD('66666666');
use mysql
update user set host='%' where user='root' and host='localhost';
flush privileges; 
exit

32.2.2 mysql 源码安装
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18.tar.gz
tar xf mysql-5.7.18.tar.gz
mv mysql-5.7.18 mysql

wget https://jaist.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz

 
cmake .  -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
 -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
 -DDEFAULT_CHARSET=utf8 \
 -DDEFAULT_COLLATION=utf8_general_ci \
 -DWITH_INNOBASE_STORAGE_engine=1 \
 -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
 -DMYSQL_DATADIR=/usr/local/mysql/data \
 -DMYSQL_TCP_PORT=3306 \
 -DWITH_BOOST=/usr/local/boost_1_59_0 \
 -DENABLE_DOWNLOADS=1 \
 -DCURSES_INCLUDE_PATH=/usr/include \
 -DCURSES_LIBRARY=/usr/lib64/libncurses.so  

cd /usr/local/mysql/bin
./mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data/ --basedir=/usr/local/mysql --socket=/usr/local/mysql/mysql.sock
cp -a support-files/mysql.server /etc/init.d/mysql
cp -a mysql.server /etc/init.d/mysql
vim /etc/my.cnf
[mysqld] 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

service mysql start
SET PASSWORD = PASSWORD('66666666');
use mysql
update user set host='%' where user='root' and host='localhost';
flush privileges; 
exit




32.3 php 安装
tar xf php-5.6.30.gz
mv php-5.6.30 ../soft/
cd ../soft/php-5.6.30/
yum install libxml2-devel
./configure --prefix=/usr/local/php  --with-apxs2=/usr/local/apache/bin/apxs  --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql  

./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--enable-zip --enable-calendar \
--with-mysql=/usr/local/mysql \
--with-pdo-mysql=/usr/local/mysql  \
--with-curl \
--with-gd=/usr/local/gd2 \
--with-png --with-zlib \
--with-freetype \
--enable-soap \
--enable-sockets \
--with-mcrypt=/usr/local/libmcrypt \
--with-mhash \
--with-zlib \
--enable-track-vars \
--enable-ftp \
--with-openssl \
--enable-dba=shared \
--with-libxml-dir \
--with-gettext \
--enable-gd-native-ttf \
--with-openssl \
--enable-mbstring

make && make install

修改 apache2让支持php
vim /etc/httpd/httpd.conf 
添加
LoadModule php5_module     modules/libphp5.so
添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
添加 DirectoryIndex
<IfModule dir_module>  
    DirectoryIndex index.html index.php  
</IfModule> 

测试
在/usr/local/apache/htdocs/info.php 创建
<?php

phpinfo();

?>

http://172.23.24.180/info.php

33.discuz 安装
【乱码】
cp php.ini-development  /usr/local/php/lib/php.ini 
vim /usr/local/php/lib/php.ini 
default_charset = "GBK"



wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip
unzip Discuz_X3.2_SC_GBK.zip -d discuz
mv discuz /usr/local/apache/htdocs/

vim /etc/httpd/httpd.conf 
添加上传文件虚拟目录
Alias /forum "/usr/local/apache/htdocs/discuz/upload"
<Directory "/usr/local/apache/htdocs/discuz/upload">
</Directory>

 



 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

捐助开发者 

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(支持支付宝和微信 以及扣扣群),没钱捧个人场,谢谢各位。

 

个人主页http://knight-black-bob.iteye.com/



 
 
 谢谢您的赞助,我会做的更好!

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
7月前
|
关系型数据库 MySQL 应用服务中间件
手动部署LNMP环境(Alibaba Cloud Linux 2)
本场景带您体验如何在Alibaba Cloud Linux 2.1903 LTS 64位操作系统的云服务器上搭建LNMP环境。
191 0
|
4月前
|
关系型数据库 应用服务中间件 nginx
基于Docker的LNMP环境微服务搭建
基于Docker的LNMP环境微服务搭建
基于Docker的LNMP环境微服务搭建
|
7月前
|
应用服务中间件 PHP nginx
基于Anolis OS 3快速搭建LNMP环境制作KodBox
本教程介绍如何搭建LNMP环境,其中本实验的LNMP分别代表Anolis OS 3、Nginx、Mariadb和PHP。
133 0
|
7月前
|
关系型数据库 MySQL 应用服务中间件
快速搭建LNMP环境
Nginx是一款小巧而高效的Web服务器软件,可帮您在Linux系统下快速方便地搭建出LNMP Web服务环境。本教程介绍如何搭建LNMP环境,其中LNMP分别代表Linux、Nginx、MySQL和PHP。
278 2
|
3月前
|
API PHP 数据库
Docker六脉神剑(四) 使用Docker-Compose进行服务编排搭建lnmp环境
Docker六脉神剑(四) 使用Docker-Compose进行服务编排搭建lnmp环境
28 0
|
8月前
|
关系型数据库 MySQL 应用服务中间件
centos7 配置LNMP环境
centos7 配置LNMP环境
|
6月前
|
关系型数据库 MySQL Linux
Linux环境下LNMP架构实战案例
Linux环境下LNMP架构实战案例
|
7月前
|
弹性计算 关系型数据库 MySQL
基于ROS快速部署LNMP环境(CentOS 7)
本教程提供在阿里云云服务器ECS上基于CentOS 7.9操作系统搭建LNMP环境的指引。LNMP是应用广泛的网站服务系统,由四种免费的开源软件Linux、Nginx、MySQL和PHP组成。搭建好LNMP环境后,您可以在该ECS实例上搭建网站、访问网站
405 0
|
7月前
|
关系型数据库 MySQL 应用服务中间件
手动部署LNMP环境(Ubuntu 20)
本教程介绍如何在Ubuntu 20.04操作系统的ECS实例上搭建一套Nginx、MySQL和PHP应用的开发环境。
290 0
|
7月前
|
关系型数据库 MySQL 应用服务中间件
基于Ubuntu搭建LNMP环境
本教程介绍如何在Ubuntu 18.04操作系统的ECS实例上搭建一套Nginx、MySQL和PHP应用的开发环境。
101 0