centos7下YGBOOK快速搭建

  • centos7下YGBOOK快速搭建已关闭评论
  • 40 views
  • A+
所属分类:linux

安装php

 

安装依赖:

yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel bzip2 libmcrypt-devel

安装yum源:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

 

安装php7:

yum install php71w php71w-fpm php71w-cli php71w-common php71w-devel php71w-gd php71w-pdo php71w-mysql php71w-mbstring php71w-bcmath

修改php配置文件:

修改/etc/php-fpm.conf内容为:

[global]
pid = /tmp/php-fpm.pid
error_log = /var/log/php-fpm/php-fpm.log
log_level = notice

[www]
listen = /tmp/php-cgi-71.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = nginx
listen.group = nginx
listen.mode = 0666
user = nginx
group = nginx
pm = dynamic
pm.status_path = /phpfpm_71_status
pm.max_children = 150
pm.start_servers = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 30
request_terminate_timeout = 100
request_slowlog_timeout = 30
slowlog = /var/log/php-fpm/slow.log

安装mysql

安装yum源

rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

安装mysql

yum -y install mysql-community-server

启动数据库

systemctl start  mysqld.service

查找root登录密码

grep "password" /var/log/mysqld.log

登录后修改root密码

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'z?guwsfsfgjdf79*)rBhH7p>';

创建数据库

mysql > create database ygbook;
mysql > grant all on ygbook.* to ygbook@'%' identified by '123456';
mysql > flush privileges;

安装nginx

yum install nginx

上传代码

代码下载,网上到处都是,随便下个。

代码放到指定的位置,我这里放到了/usr/share/nginx/html/下解压,如下:

[root@k3s html]# pwd
/usr/share/nginx/html
[root@k3s html]# ls
Application favicon.ico index.php logreport Public robots.txt ThinkPHP uploads vendor

设置权限

chown -R nginx:nginx /usr/share/nginx/html
chmod -R 777 /usr/share/nginx/html

启动php-fpm

php-fpm

配置NGINX

修改/etc/nginx/nginx.conf为如下内容:

user nginx;
worker_processes 2;
error_log /var/log/nginx/error.log error;
pid /run/nginx.pid;
events {
 worker_connections 655350;
 multi_accept on;
}
http {
 include mime.types;
 client_body_buffer_size 512k;
 proxy_connect_timeout 60;
 proxy_read_timeout 60;
 proxy_send_timeout 60;
 proxy_buffer_size 32k;
 proxy_buffers 4 64k;
 proxy_busy_buffers_size 128k;
 proxy_temp_file_write_size 128k;
 proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
 default_type application/octet-stream;
 server_names_hash_bucket_size 512;
 client_header_buffer_size 32k;
 large_client_header_buffers 4 32k;
 client_max_body_size 50m;
 sendfile on;
 tcp_nopush on;
 keepalive_timeout 60;
 tcp_nodelay on;
 fastcgi_connect_timeout 300;
 fastcgi_send_timeout 300;
 fastcgi_read_timeout 300;
 fastcgi_buffer_size 64k;
 fastcgi_buffers 4 64k;
 fastcgi_busy_buffers_size 128k;
 fastcgi_temp_file_write_size 256k;
 fastcgi_intercept_errors on;
 gzip on;
 gzip_min_length 1k;
 gzip_buffers 4 16k;
 gzip_http_version 1.1;
 gzip_comp_level 2;
 gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
 gzip_vary on;
 gzip_proxied expired no-cache no-store private auth;
 gzip_disable "MSIE [1-6]\.";
 limit_conn_zone $binary_remote_addr zone=perip:10m;
 limit_conn_zone $server_name zone=perserver:10m;
 server_tokens off;
 access_log off;

server {
 listen 80 default_server;
 listen [::]:80 default_server;
 server_name xiaoshuo.baiked.com;
 index index.html index.htm index.php;
 root /usr/share/nginx/html;
 location / {
 if (!-e $request_filename) {
 rewrite ^(.*)$ /index.php?s=$1 last;
 }
 }
 location ~ [^/]\.php(/|$) {
 try_files $uri =404;
 fastcgi_index index.php;
 fastcgi_pass unix:/tmp/php-cgi-71.sock;
 include fastcgi.conf;
 }
 }
}

其中/etc/nginx/下的fastcgi.conf(没有就自己创建)内容为:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;

启动NGINX

nginx

好,到处配置完成了,我们下载安装YGBOOK。

安装YGBOOK

浏览器访问服务器ip,点击同意,继续安装即可,中间过程需要配置数据库信息,就是上面创建的数据库,授权用户名和密码,如下:

centos7下YGBOOK快速搭建

 

点击开始安装,安装完成后,自动跳转到首页,如下:

centos7下YGBOOK快速搭建

访问管理端

http://ip/admin

通过安装时设置的admin以及密码登录,如下:

centos7下YGBOOK快速搭建

配置采集就不说了,自己网上搜索一下,到处都是。

 

  • 安卓客户端下载
  • 微信扫一扫
  • weinxin
  • 微信公众号
  • 微信公众号扫一扫
  • weinxin
avatar