wordpress 快速搭建个人博客 教程 (二) 配置 nginx
2018-03-16 18:22
856 查看
现在我们需要配置一下 nginx 服务器
首先使用 cp 命令把我们下载好的 wordpress 拷贝到 nginx 根目录
然后我们需要更改nginx的配置文件
使用 cd 命令跳转到 nginx 配置目录
使用 vim 编辑器编辑 default.conf
把内容编辑为如下
然后 按 ESC 键 在按 wq 保存退出
然后我们就可以访问 wordpress 了 如下图
首先使用 cp 命令把我们下载好的 wordpress 拷贝到 nginx 根目录
cp -rf wordpress /usr/share/nginx/html/
然后我们需要更改nginx的配置文件
使用 cd 命令跳转到 nginx 配置目录
cd /etc/nginx/conf.d/并备份一份 default.conf 为 default.conf.bak
使用 vim 编辑器编辑 default.conf
把内容编辑为如下
server { listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { root /usr/share/nginx/html/wordpress; index index.html index.htm index.php; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /usr/share/nginx/html/wordpress; server { listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { root /usr/share/nginx/html/wordpress; index index.html index.htm index.php; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /usr/share/nginx/html/wordpress; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
然后 按 ESC 键 在按 wq 保存退出
然后我们就可以访问 wordpress 了 如下图
相关文章推荐
- wordpress 快速搭建个人博客 教程 (三) 安装 wordpress
- 阿里云ECS服务器+WordPress快速搭建个人博客
- 小白教程 | 利用Github Pages快速搭建个人博客
- 阿里云+wordpress搭建个人博客网站【小白专用的图文教程】
- 【转】阿里云+wordpress搭建个人博客网站【小白专用的图文教程】
- Docker快速搭建个人博客网站(wordpress+mysql)
- 阿里云ECS服务器搭建wordpress个人博客网站【详细图文教程】
- 阿里云+wordpress搭建个人博客网站【小白专用的图文教程】
- 使用wordpress在appache php mysql环境下快速搭建个人博客!!!
- SAE+WordPress快速搭建个人博客
- 阿里云+wordpress搭建个人博客网站【小白专用的图文教程】
- Centos7 使用WordPress快速搭建个人博客
- DigitalOcean上使用Tornado+MongoDB+Nginx+Supervisor+DnsPod快速搭建个人博客
- 阿里云+wordpress搭建个人博客网站【小白专用的图文教程】
- 利用腾讯云1元机和服务市场wordpress快速搭建个人博客
- 阿里云+wordpress搭建个人博客网站【小白专用的图文教程】
- AMH面板+wordpress搭建个人博客详细教程(上)
- win7下wordPress本地搭建博客详解(深度亲测整理---傻瓜式详细教程)
- WordPress快速搭建博客网站
- 使用Hexo+GitHub搭建及配置个人博客