打开\wp-content\themes\twentysixteen\template-parts目录下的两个文件:
content.php
content-single.php
注释掉twentysixteen_entry_meta();这个函数调用。
银色飞翼的隐蔽藏身地
打开\wp-content\themes\twentysixteen\template-parts目录下的两个文件:
content.php
content-single.php
注释掉twentysixteen_entry_meta();这个函数调用。
source/class/discuz/discuz_application.php (大概在第 190 行处)
查找: $_G[‘isHTTPS’] =
这一行直接修改为: $_G[‘isHTTPS’] = true;
# BEGIN WordPress # 在“BEGIN WordPress”与“END WordPress”之间的指令(行)是 # 动态生成的,只应被WordPress过滤器修改。 # 任何对标记之间的指令的修改都会被覆盖。 # END WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </IfModule> php_value upload_max_filesize 64M php_value post_max_size 64M php_value max_execution_time 300 php_value max_input_time 300
添加
define("FORCE_SSL_ADMIN", true); define( 'RLRSSSL_DO_NOT_EDIT_HTACCESS', TRUE );
1.固定IP设置
使用ifconfig查看当前网卡设备名
更改/etc/dhcpcd.conf
interface 网卡名
static ip_address=192.168.1.88/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8
2.更改软件源
/etc/apt/sources.list
deb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main contrib non-free rpi
3.搭建LNMP服务器
sudo apt-get update
sudo apt-get install nginx php5-fpm php5-cli php5-curl php5-gd php5-mcrypt php5-mysql php5-cgi mysql-server
nginx设置
修改配置/etc/nginx/sites-available/default
server {
listen 80;
server_name localhost;
root /var/www/html/;
access_log /var/log/nginx/localhost.access.log;
#error_page 404 /404.html;
location / {
index index.html index.htm index.php default.html default.htm default.php;
}
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 1d;
}
location ~ .*\.php(\/.*)*$ {
root /var/www/html;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
4.安装phpmyadmin
sudo apt-get install phpmyadmin
sudo ln -s /usr/share/phpmyadmin /var/www/html
5.mysql设置账户
create database wordpress;
create user ‘joshliu357’@’%’ identified by ‘123456’;
grant all on wordpress.* to joshliu357@’%’ identified by ‘123456’;
6.安装wordpress
将wordpress安装包解压至/var/www/html/wordpress
开启权限
chmod -R 777 /var/www/html/wordpress为了保证正常安装插件
生成wp-config.php后
最后添加
define(“FS_METHOD”,”direct”);
define(“FS_CHMOD_DIR”, 0777);
define(“FS_CHMOD_FILE”, 0777);
为了更改wordpress上传图片大小限制
在/etc/nginx/nginx.conf适当地方添加
client_max_body_size 100m;
在wordpress根目录添加一个文件maxsize.ini
内容为
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 300
创建链接
sudo ln -s /var/www/html/wordpress/maxsize.ini /etc/php5/fpm/conf.d/
或者在.htaccess添加
php_value upload_max_filesize 100M
php_value post_max_size 100M
nginx静态链接设置
location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
location /wordpress/ {
try_files $uri $uri/ /wordpress/index.php?q=$uri&$args;
}
apache和nginx反向代理设置
/etc/apache2/ports.conf 中
NameVirtualHost *:8080
Listen 8080
/etc/apache2/sites-enabled/000-default中
<VirtualHost *:8080>
/etc/nginx/sites-available/default中
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080;
apache的wordpress伪静态
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
7.树莓派swap扩容
sudo dd if=/dev/zero of=/swapfile bs=1M count=3072
sudo mkswap /swapfile
sudo swapoff /var/swap
sudo swapon /swapfile
更改/etc/fstab加入行
/swapfile swap swap defaults 0 0
8.ftp设置
/etc/vsftpd.conf中
local_enable=YES
write_enable=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
allow_writeable_chroot=YES
/etc/vsftpd.chroot_list中
pi
/var/www/html/目录所有者root所属组pi
chown -R root:pi /var/www/html/
设置权限
chmod -R 775 /var/www/html/
chmod -R 777 /var/www/html/wordpress/wp-content
创建ftp用户
useradd -d /var/www/html/ -s /bin/bash ftpuser
passwd ftpuser
把ftpuser加入pi组
usermod -a -G pi ftpuser
并sudo ln -s /medai/pi/TOSHIBA samba把移动硬盘链接至主目录下
通过这些设置ftp用户pi可访问其主目录和移动硬盘目录以及父目录
ftpuser仅可访问网站根目录
9.samba设置
sudo apt-get install samba samba-common-bin
/etc/samba/smb.conf中
[Raspberry Pi Share]
path = /media/pi/TOSHIBA
valid users = root pi
public = yes
writable = yes
[HTTP Server Root]
path = /var/www/html
valid users = root pi
public = yes
writable = yes
并smbpasswd –a pi添加samba用户
通过以上设置root和pi用户可访问移动硬盘和网站根目录
写了一个shell脚本,用于mount FTP的fs,前提是已经安装curlfptfs。挂载后可以读写
#!/bin/bash function pretreatment(){ if which curlftpfs; then echo "Found." else echo -e "The command \"curlftpfs\" does not exist, please install it before running this script." exit fi uid_test echo "Got your UID: $uid" } function uid_test(){ case $(uname -s) in Linux) uid=$(cat /etc/passwd | grep $(whoami) | awk -F: '{print $3;}');; Darwin) uid=$(dscl . -list /Users UniqueID | grep $(whoami) | awk '{print $2}');; *) echo "Unknown system (not Linux or macOS). Continue or not? (y or n)" read choice1; if [ "$choice1" == "y" ]; then read -p "Please input your UID" uid else exit fi ;; esac } function connect(){ read -p "Server address (without prefix ftp://): " address read -p "Login name: " username read -s -p "Login password: " password echo read -p "Local directory: " directory echo "Now will mount the FTP to the local file system." echo read -p "Press enter to continue." echo echo -e "Running \"curlftpfs -o rw,allow_other,uid=${uid} ftp://${username}:****@${address} $directory\". " curlftpfs -o rw,allow_other,uid=${uid} ftp://${username}:${password}@${address} ${directory} } function retry_test(){ if [ "$?" -ne 0 ]; then echo echo "Failed. Would you like to retry? ( y or n )" read choice2 if [ "$choice2" == "y" ]; then connect retry_test else exit fi else echo "Successfully mounted." echo fi } pretreatment connect retry_test
https://cn.wordpress.org/ 下载wordpress安装包
apt-get 安装 php php-fpm php-mysql php-gd mysql-server
安装并注册mysql root账户
建立数据库 create database wordpress;
建立自己账户 CREATE USER ‘josh’@’localhost’ IDENTIFIED BY ‘123456’;
grant all on wordpress.* to josh@localhost identified by ‘123456’;
将wordpress安装包解压至/var/www/html/wordpress
开启权限 chmod -R 777 /var/www/html/wordpress
登录127.0.0.1登入配置网页进行安装
生成wp-config.php后
最后添加
define(“FS_METHOD”,”direct”);
define(“FS_CHMOD_DIR”, 0777);
define(“FS_CHMOD_FILE”, 0777);
插件Crayon Syntax Highlighter
WP Database Backup
jonradio Multiple Themes
主题 TwentySixteen
固定链接设定为 http://localhost/wordpress/index.php/%year%/%monthnum%/%postname%/
apt-get install vsftpd
/etc/vsftpd.conf 添加
anonymous_enable=NO #禁止匿名访问
local_enable=YES
write_enable =YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
allow_writeable_chroot=YES
useradd -d /var/www/http/ -s /bin/bash ftpuser
passwd ftpuser
usermod -a -G ftpuser josh
chown -R :ftpuser /var/www/http/
chmod -R 775 /var/www/http/
chmod -R 777 /var/www/http/wordpress/wp-content