重点在于安装php,他需要版本>=7.2
1.配置源
-
yum install epel-release
-
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2.安装php环境
yum -y install php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml php72w php72w-bcmath php72w-dba php72w-enchant php72w-imap php72w-interbasephp72w-intl php72w-ldap php72w-mcrypt php72w-odbc php72w-pdo_dblib php72w-pear php72w-pecl-apcu php72w-pecl-imagick php72w-pecl-xdebug php72w-pgsql php72w-phpdbg php72w-process php72w-pspell php72w-recode php72w-snmp php72w-soap php72w-tidy php72w-xmlrpc php72w-pecl-igbinary php72w-intl php72w-memcached php72w-pecl-mongodb php72w-cli php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-pdo php72w-xml php72w-pear php72w-devel
3.php-v查看版本,出现7.2即可
然后安装其他部分
安装数据库:
systemctl restart mariadb.service # Start MySQL service
mysql_secure_installation # Set root password
mysql -u root -p # Enter root password you just set
CREATE DATABASE IF NOT EXISTS bookstackdb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON bookstackdb.* TO 'bookstackuser'@'localhost' IDENTIFIED BY 'bookstackpass' WITH GRANT OPTION;
FLUSH PRIVILEGES;
quit
设置php-fpm
vi /etc/php-fpm.d/www.conf # Set critcal settings
----
listen = /var/run/php-fpm.sock
listen.owner = nginx ; SOCKS permission
listen.group = nginx ; SOCKS permission
listen.mode = 0660 ; SOCKS permission
user = nginx ; PHP-FPM running user
group = nginx ; PHP-FPM running group
php_value[session.save_path] = /var/www/sessions
---
设置nginx
建议直接写到nginx.conf里
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig # Backup original file
vi /etc/nginx/nginx.conf # Nginx config
---
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
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 /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
}
---
vi /etc/nginx/conf.d/bookstack.conf # Server config
---
server {
listen 80;
server_name localhost;
root /var/www/BookStack/public;
access_log /var/log/nginx/bookstack_access.log;
error_log /var/log/nginx/bookstack_error.log;
client_max_body_size 1G;
fastcgi_buffers 64 4K;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README) {
deny all;
}
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/php-fpm.sock;
}
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
access_log off;
}
}
---
设置部署bookstack
cd /usr/local/bin # Change dirs to where we want composer installed to
curl -sS https://getcomposer.org/installer | php # Install composer
mv composer.phar composer # Rename composer
cd /var/www # Change dirs to where we want BookStack installed to
mkdir /var/www/sessions # Dir for php sessions
git clone https://github.com/BookStackApp/BookStack.git --branch release --single-branch # Clone the latest from the release branch
cd BookStack && composer install # Change dirs into the BookStack dir, and let composer do it's thing
cp .env.example .env # Make a copy of the example config
vi .env # Update the new config with database, and other settings
---
DB_HOST=localhost
DB_DATABASE=bookstackdb
DB_USERNAME=bookstackuser
DB_PASSWORD=bookstackpass
---
其他设置都默认就完事了
php artisan key:generate --force # Generate and update APP_KEY in .env
chown -R nginx:nginx /var/www/{BookStack,sessions} # Change ownership to the webserver user
php artisan migrate --force # Generate database tables and other settings
现在配置差不多了
打开服务,重启后直接输ip进
systemctl enable nginx.service && systemctl enable mariadb.service && systemctl enable php-fpm.service
systemctl reboot
基于Apache的安装方法:
前边都一样,除了nginx那块不需要配置,转变成下边的方法
Apache配置文件内如下修改
重启Apache
进到/var/www内使用
chmod -R 777 BookStack
chmod -R 777 sessions
然后开tmd网页
进ip:8080就完事了