目录
服务器系统
更新第三方源并升级系统
安装和配置Nginx
安装和配置PHP
安装MySql创建EduSoho数据库
安装EduSoho
安装discuz
服务器系统
#服务器系统
#系统:阿里云centos6.8_64
更新第三方源并升级系统
(CentOS默认的标准源里没有nginx软件包)
安装CentOS第三方yum源
#安装下载工具wget
yum install wget
#下载atomic yum源
wget http://www.atomicorp.com/installers/atomic
#安装
sh ./atomic
升级CentOS系统
#更新yum软件包
yum check-update
#更新系统
yum update
关闭防火墙
阿里云的防火墙默认是关闭的,要控制端口可以去设置安全组
#检测防火墙是否关闭
[root@hy ~]# getenforce Disabled [root@hy ~]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination
安装和配置Nginx
yum install nginx
#启动
service nginx start
#设为开机启动
chkconfig nginx on
vi /etc/nginx/nginx.conf
在http{}配置中加入:
client_max_body_size 1024M;
添加配置文件
vi /etc/nginx/conf.d/edusoho.conf
加入以下配置:
server { listen 80; server_name ip; root /usr/share/nginx/edusoho/web; access_log /var/log/nginx/edusoho.access.log; error_log /var/log/nginx/edusoho.error.log; location / { index app.php; try_files $uri @rewriteapp; } location @rewriteapp { rewrite ^(.*)$ /app.php/$1 last; } location ~ ^/udisk { internal; root /usr/share/nginx/edusoho/app/data/; } location ~ ^/(app|app_dev)\.php(/|$) { fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTPS off; fastcgi_param HTTP_X-Sendfile-Type X-Accel-Redirect; fastcgi_param HTTP_X-Accel-Mapping /udisk=/usr/share/nginx/edusoho/app/data/udisk; fastcgi_buffer_size 128k; fastcgi_buffers 8 128k; } location ~* \.(jpg|jpeg|gif|png|ico|swf)$ { expires 3y; access_log off; gzip off; } location ~* \.(css|js)$ { access_log off; expires 3y; } location ~ ^/files/.*\.(php|php5)$ { deny all; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTPS off; include fastcgi_params; } }
#重启nginx
/etc/init.d/nginx restart
## 安装和配置PHP
配置安装包源
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
安装PHP和相关插件
yum install -y php55w php55w-cli php55w-curl php55w-fpm php55w-intl php55w-mcrypt php55w-mysql php55w-gd php55w-mbstring php55w-xml php55w-dom
修改PHP配置
#编辑php.ini , 将以下配置的值修改为1024M
vi /etc/php.ini
post_max_size = 1024M
memory_limit = 1024M
upload_max_filesize = 1024M
配置PHP-FPM
#启动php-fpm
/etc/rc.d/init.d/php-fpm start
#设置开机启动
chkconfig php-fpm on
安装MySql创建EduSoho数据库
安装MySql
#询问是否要安装,输入Y即可自动安装,直到安装完成
yum install mysql mysql-server
#拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆盖即可)
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
#启动MySQL
/etc/init.d/mysqld start
#设为开机启动
chkconfig mysqld on
#mysql进入数据库,设置密码(安装完默认密码为空)
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('initpassword');
创建EduSoho数据库
#登录数据库
mysql -uroot -pinitpassword
#创建数据库及账号
CREATE DATABASE edusoho DEFAULT CHARACTER SET utf8 ; GRANT ALL PRIVILEGES ON `edusoho`.* TO 'esuser'@'localhost' IDENTIFIED BY 'edusoho'; quit;
注意:这里为edusoho数据库创建了一个用户名,用户名为:esuser,密码为edusoho,在后面安装的第三步需要用到,不建议直接填写root账户。
下载和解压EduSoho
cd /usr/share/nginx wget http://download.edusoho.com/edusoho-Version.tar.gz (注:将VERSION替换为当前EduSoho最新版本号,可从官网www.edusoho.com查询获取) tar zxvf edusoho-Version.tar.gz chown apache:apache edusoho/ -Rf
配置完成后,请使用ip访问安装,浏览器输入ip回车后自动跳转到**EduSoho**安装界面
安装discuz
获取discuz源码
/usr/share/nginx mkdir discuz cd !$ wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip yum install unzip -y unzip Discuz_X3.2_SC_UTF8.zip mv upload/* . rm -rf Discuz_X3.2_SC_UTF8.zip upload/ utility/ readme/
配置nginx
vim discuz.conf server { #监听端口 listen 8000; #服务器文件目录 root /usr/share/nginx/discuz; #首页文件 index index.html index.php; #域名 server_name www.test.com www.test2.com; #php解析 location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/discuz$fastcgi_script_name; include fastcgi_params; } }
# 检测nginx配置是否正确
nginx -t
#重载nginx服务
nginx -s reload
配置数据库
create database discuz; grant all on discuz.* to 'discuz'@'localhost' identified by 'discuz'; chmod -R 777 data uc_server/data/ uc_client/data config
**安装discuz**
访问ip:8000,自动跳转到到**discuz**安装页面