Linux搭建lnmp并部署WeCenter博客
WeCenter源码链接:https://down.chinaz.com/soft/432.htm
准备环境:
service firewalld stop set enforce 0
vim /etc/yum.repos.d/nginx.repo [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/7/$basearch/ gpgcheck=0 enabled=1
保存退出
yum install -y nginx
yum install -y mariadb mariadb-server service mariadb start mysql_secure_installation mysql -uroot -p
create database <库名>;
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 安装PHP yum -y install php72w php72w-cli php72w-common php72w-devel php72wembedded php72w-gd php72w-mbstring php72w-pdo php72w-xml php72w-fpm php72w-mysqlnd php72w-opcache
vim /etc/php-fpm.d/www.conf user = nginx group = nginx #PS:保证nginx进行的管理用户和php服务进程的管理用户保持一致 service php-fpm restart //重启服务
vim /etc/nginx/conf.d/bbb.conf server { listen 80; server_name localhost; location / { root /usr/share/nginx/html; //nginx网页代码存放目录 index index.html index.php; } location ~ \.php$ { root /usr/share/nginx/html; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; } }
cd /usr/share/nginx/html vim test.php //编辑一个php配置文件 cat test.php <?php phpinfo(); ?> 重启nginx服务,进行测试
我这里采用的是cmd里面的scp scp <文件名> root@<Linux主机的ip>:/ <你要传入Linux的哪个位置,我就先传到/目录>
unzip WeCenter_v3.3.0.zip //解压此文件
vim /etc/nginx/conf.d/ccc.conf cat ccc.conf server { listen 80; server_name localhost; location / { root /usr/share/nginx/html/we; index index.html index.php; } location ~ \.php$ { root /usr/share/nginx/html/we; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; } } 保存退出 进入/usr/share/nginx文件夹,给html文件夹下的所有文件的所属组和用户更改 chown nginx:nginx -R html 重启nginx服务 service nginx restart