目錄
服務器系統
更新第三方源並升級系統
安裝和配置Nginx
安裝和配置PHP
安裝MySql建立EduSoho數據庫
安裝EduSoho
安裝discuzphp
服務器系統css
#服務器系統
#系統:阿里雲centos6.8_64html
更新第三方源並升級系統
(CentOS默認的標準源裏沒有nginx軟件包)mysql
安裝CentOS第三方yum源
#安裝下載工具wget
yum install wget
#下載atomic yum源nginx
wget http://www.atomicorp.com/installers/atomic
#安裝web
sh ./atomic
升級CentOS系統
#更新yum軟件包sql
yum check-update
#更新系統數據庫
yum update
關閉防火牆
阿里雲的防火牆默認是關閉的,要控制端口能夠去設置安全組
#檢測防火牆是否關閉apache
[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
安裝和配置Nginxvim
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**安裝頁面