打开/etc/nginx下的nginx.conf,其中server部分修改如下:
server { listen 80 default_server; listen [::]:80 default_server; server_name ffflipped.cn; root /usr/www; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { index index.php; try_files $uri $uri/ /index.php?$args; } rewrite /wp-admin$ $scheme://$host$uri/ permanent; location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { access_log off; log_not_found off; expires max; } location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
保存后重载nginx
#systemctl reload nginx
在/usr/www 目录中创建 index.php
测试:123.206.57.252 或者解析好的域名http://ffflipped.cn 可以看到hello world!
4安装wordpress
4.1搭建站点
下载并解压好wordpress安装包,用winscp将/wordpress下的文件夹和文件全部上传到/usr/www/目录下。
修改wp-config-sample.php的MySQL数据库信息,里面MySQL主机就填localhost,而不是公网IP之类的。
保存后访问 123.206.57.252 填写站点信息,接近成功了!
4.2权限设置
但是会发现写博时不能上传图片,后台不能安装插件和主题,这时候就是权限问题。
wp-config.php文件最后加上下面这句:
define(‘FS_METHOD', “direct”);
再去执行命令
#chmod 777 /usr/www -R #这里的-R是递归子目录、文件 #systemctl reload nginx
虽然777(最大读写权限)不安全,但是我这个小白也只会这样解决了。
总结
冒着期中考没复习而可能挂科的风险,呸,我不可能挂科,来折腾服务器搭博客,我怎么能这样呢?不管啦。总之,好有成就感,爽。
标签:WordPress
相关阅读 >>
wordpress获取自定义字段get_post_meta函数使用介绍
wordpress中函数get_term_link的参数设置问题
nginx下修改wordpress固定链接导致无法访问的问题解决
更多相关阅读请进入《wordpress》频道 >>