Discuz是一套通用的社区论坛软件系统,用户可以在不需要任何编程的基础上,通过简单的设置和安装,在互联网上搭建起具备完善功能、很强负载能力和可高度定制的论坛服务。今天我们就使用redhat7.2的镜像在Linux上使用LNMP环境搭建一个简单的Discuz论坛~
前几篇我们有说到LNMP的环境搭建,现在呐~我们就i开始搭建一个Discuz论坛叭~
首先我们准备Discuz安装包,此处附上大佬的网盘永久连接:https://pan.baidu.com/s/14ZPFy35pnpYpKeePDFoArw 密码:2olg
1、指定安装包目录并解压
[root@localhost local]# unzip Discuz_X3.3_SC_UTF8.zip
[root@localhost local]# mv upload/ /var/www/
2、编辑nginx配置文件
[root@localhost local]# vi /usr/local/nginx/conf/nginx.conf
[root@localhost local]# cat /usr/local/nginx/conf/nginx.conf
user ruready ruready;
worker_processes 2;
error_log /usr/local/nginx/logs/error.log crit; # 日志位置和日志级别
pid /usr/local/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 65535;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /usr/local/nginx/logs/access.log main;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
# 下面是server虚拟主机的配置
server {
listen 80;#监听端口
server_name localhost;#域名
charset utf-8;
access_log /usr/local/nginx/logs/host.access.log main;
########将root后面的html换成了指定的目录/var/www
location / {
root /var/www;
index index.html index.htm index.php;
expires 1d;
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#######将$document_root换成/var/www/
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
3、创建指定目录并授予权限
[root@localhost local]# mkdir /var/www -p
[root@localhost www]# cd upload/
[root@localhost upload]# chown -R php config data uc_client/data/ uc_server/data/
[root@localhost upload]# chmod -R 777 ../upload/
4、重启nginx,在网页中安装
[root@localhost upload]# /usr/local/nginx/sbin/nginx -s reload
输入网址如下网址:
登录时会一直停在这个界面导致我们进不去个人页面,所以需要去修改文件:
[root@localhost upload]# vi source/class/class_core.php
注释这几行:
之后再刷新一下就进去了
然后呐~就搭建完成啦。搭建的时候一定要注意配置文件的修改,当时忘记修改第一个location的root,就出现了路径不存在的错误,细心细心再细心。