LNMP搭建个人博客
阿里云系统centos7.3
一、关闭防火墙
selinux 改成 disable
systemctl stop firewalld
vim /etc/sysconfig/selinux
二、安装服务器
先安装linux的下载软件:wget
1.安装nginx
wget下载Nginx安装包:
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
建立nginx的yun仓库:
rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
开始安装:
yum install -y nginx
2.安装MySQL
wget 下载MySQL安装包:
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
建立MySQL的yum 仓库:
rpm -ivh mysql-community-release-el7-5.noarch.rpm
开始安装并设置用户权限:
yum install -y mysql-server
chown -R root:root /var/lib/mysql
登陆修改MySQL 密码:
3.安装php
wget 下载PHP安装包:
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
建立PHP的yum仓库:
rpm -ivh webtatic-release.rpm
开始安装:
yum install -y php70w
##注意还要安装PHP扩展包:
yum install -y php70w-mysql.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64
安装php-fpm:yum install -y php70w-fpm
三、修改配置文件:
1.vim /etc/nginx/nginx.conf
###注意可以自己修改,这是我的修改
[root@web nginx]# cat /etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name 172.17.37.21;
charset utf-8;
access_log log/host.access.log main;
location / {
root /etc/nginx/www;
index index.html index.php;
}
location ~ \.php$ {
root /etc/nginx/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
include /etc/nginx/conf.d/*.conf;
}
2.vim /etc/php-fpm.d/www.conf
找到 修改成这样:
user =nginx
group=nginx
四、启动安装的所有服务
systemctl start nginx
systemctl start php-fpm
五、参照LAMP的方式导入 wordpress个人博客网站