安装nginx,并且配置一个论坛
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repoyum install centos-release-scl -yyum -y install nginx mariadb-server rh-php72-php rh-php72-php-cli rh-php72-php-common rh-php72-php-fpm rh-php72-php-gd rh-php72-php-mbstring rh-php72-php-pdo rh-php72-php-xml rh-php72-php-mysqlnd rh-redis5 sclo-php72-php-pecl-redis5
配置文件
vim /etc/opt/rh/rh-php72/php-fpm.d/www.confuser = nginxgroup = nginx
论坛代码可到官网下载:https://www.discuz.net/forum-10-1.html
unzip -q Discuz_X3.3_SC_UTF8.zip -d /code/discuz/
chown -R nginx:nginx /code/discuz/
server {
listen 80;
server_name discuz.kongd.com;
root /code/discuz/upload;
location / {
index index.php index.html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
启动服务
systemctl enable nginx.service mariadb.service rh-php72-php-fpm.service rh-redis5-redis.service --now
输入ip就能访问了
vim /etc/nginx/conf.d/monitor.conf
server {
listen 127.0.0.1:80;
server_name 127.0.0.1;
location /nginxstatus {
stub_status on;
access_log off;
allow 127.0.0.1;
}
}
nginx -t 检查
nginx -s reload #加载配置
测试 curl http://127.0.0.1//nginxstatus
Active connections:当前活跃的客户端连接数,包括Waiting连接数;
accepts :接受的客户端连接总数;handled :已处理的连接总数。通常与 “accepts” 的值相同,除非达到某些资源限制,如 “worker_connections” ;requests :客户端请求总数,一个客户端连接可能包含多个请求;Reading : Nginx 正在读取请求标头的当前连接数;Writing : Nginx 正在将响应写回给客户端的当前连接数;Waiting :当前等待请求的空闲连接数。
然后添加宏定义,可以在官方文档中找到