[vc_row][vc_column][vc_toggle title=”warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory” style=”simple” custom_font_container=”tag:h2|font_size:16|text_align:left” custom_google_fonts=”font_family:ABeeZee%3Aregular%2Citalic|font_style:400%20regular%3A400%3Anormal” use_custom_heading=”true”]vi /etc/environment
add these lines…
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
https://gist.github.com/jampajeen/841d4eed4da3e6c758bf[/vc_toggle][vc_toggle title=”How to create and extract zip, tar, tar.gz and tar.bz2 files in Linux” style=”simple” color=”blue” custom_font_container=”tag:h2|font_size:16|text_align:left” custom_google_fonts=”font_family:ABeeZee%3Aregular%2Citalic|font_style:400%20regular%3A400%3Anormal” use_custom_heading=”true”]
TAR.GZ
This format is my weapon of choice for most compression. It gives very good compression while not utilizing too much of the CPU while it is compressing the data. To compress a directory use the following syntax:
# tar -zcvf archive_name.tar.gz directory_to_compress
To decompress an archive use the following syntax:
# tar -zxvf archive_name.tar.gz
This will extract the files in the archive_name.tar.gz archive in the current directory. Like with the tar format you can optionally extract the files to a different directory:
# tar -zxvf archive_name.tar.gz -C /tmp/extract_here/
https://www.simplehelp.net/2008/12/15/how-to-create-and-extract-zip-tar-targz-and-tarbz2-files-in-linux/[/vc_toggle][vc_toggle title=”swapfile” style=”simple” color=”turquoise” custom_font_container=”tag:h2|font_size:16|text_align:left” custom_google_fonts=”font_family:ABeeZee%3Aregular%2Citalic|font_style:400%20regular%3A400%3Anormal” use_custom_heading=”true”]
#9.2添加Swap交换分区
此方法只适用于虚拟化技术为KVM和Xen的VPS,OpenVZ不支持添加Swap交换分区,也就说说搬瓦工VPS(KVM-512MB套餐除外)不能用此方法增加Swap空间。
如果搬瓦工VPS管理后台Swap状态长期显示红色,则表明VPS内存已满,该考虑升级VPS了。
关于Swap分区的具体含义在此不再赘述,详细可以参考百度百科:Swap分区
简单来说,当VPS的物理内存不够用时,系统会占用一部分Swap分区作为临时内存,目的是防止因物理内存耗尽而可能出现的错误。
因此,对小内存VPS来说,设置一定大小的Swap交换分区显然很有意义。
但是,由于硬盘的 I/O 读写速度远不能和内存的读写速度相提并论(可能相差几十倍),使用Swap交换分区时,系统可能会变得特别缓慢、卡顿,甚至程序会出现错误。
因此,要尽量避免使用Swap分区,不得不使用时也不宜设置过大(大了也没用还占用空间),也就是说:我们不能指望用Swap来代替物理内存使用。甚至于,当你的VPS物理内存很充足时,完全可以禁用Swap以提高VPS的响应速度。
当物理内存(实际使用内存)长期处于耗尽状态时,正确的做法就是该升级套餐了。
添加Swap交换分区
使用root用户登陆PuTTY,进入var文件目录:
# cd /var/
获取256MB的文件块(一般设置为内存的0.5倍即可):
# dd if=/dev/zero of=swapfile bs=1M count=256
创建Swap文件:
# /sbin/mkswap swapfile
激活Swap文件:
# /sbin/swapon swapfile
为了安全,建议修改一下权限:
# chmod 0644 /var/swapfile
将swapfile添加到fstab文件中,开机自动启动:
# echo "/var/swapfile swap swap defaults 0 0" >> /etc/fstab
搞定了。此时查看内存信息:
# free -m
出现 “Swap: 256” 字样表示设置成功。
修改 swappiness 默认值
上面说了,我们要尽量避免使用Swap分区。所以,这里我们需要额外做些修改,使系统尽可能的优先使用物理内存。
首先查看下 swappiness 的默认值:
# cat /proc/sys/vm/swappiness
通常,返回值是60(默认值)。
实际上,swappiness = 0 表示最大限度使用物理内存,然后才使用swap分区;swappiness = 100 表示系统积极的使用swap分区,然后才使用物理内存。
显然,这里我们需要降低 swappiness 的默认值。
# vi /etc/sysctl.conf
在里面添加 vm.swappiness=10 字段,然后退出保存。
或者:
# echo "vm.swappiness=10" >> /etc/sysctl.conf
然后 reboot 一下VPS即可。
[/vc_toggle][vc_toggle title=”VPS建站: LAMP搭建WordPress博客+优化安装教程 (Vultr & 搬瓦工VPS亲测)” style=”simple” color=”pink” custom_font_container=”tag:h2|font_size:16|text_align:left” custom_google_fonts=”font_family:ABeeZee%3Aregular%2Citalic|font_style:400%20regular%3A400%3Anormal” use_custom_heading=”true”]
- 1 + 为什么要用WordPress建站
- 2 + 选择虚拟主机还是VPS
- 3 + 注册域名
- 4 + 如何选购便宜的VPS
- 5 + SSH连接VPS
- 6 + 搭建LAMP环境
- 7 + 添加域名 / 虚拟主机
- 8 + 安装WordPress程序
- 9 + VPS配置优化
- 10 + 删除mysql-bin.0000*日志文件
- 11 + Linux-VPS安全配置 / 防护措施
- 12 + 创建VPS快照
- 13 + 写在最后
http://www.seoimo.com/wordpress-vps/[/vc_toggle][vc_toggle title=”One-Click WordPress” style=”simple” color=”violet” custom_font_container=”tag:h2|font_size:16|text_align:left” custom_google_fonts=”font_family:ABeeZee%3Aregular%2Citalic|font_style:400%20regular%3A400%3Anormal” use_custom_heading=”true”]
App Details
WordPress runs on the CentOS 6 x64 operating system. You can log into this system with an SSH client using the root login found on your Vultr control panel.
Initially, you will need to access https://[SERVER_IP]/wp-admin/
in your web-browser. Substitute the [SERVER_IP]
with the IP address of your VPS. The certificate warning can be safely ignored. Login credentials are sent to you in an email, and can also be found in your Vultr control panel. Once you have completed the WordPress setup, you can access your WordPress site at http://[SERVER_IP]/
or https://[SERVER_IP]/
.
You may also want to point the DNS “A record” of your website to your [SERVER_IP]
. This will allow you to access WordPress by navigating to your website (www.example.com
). If you update your DNS record, be sure to edit your “WordPress Address (URL)” and “Site Address (URL)” to match your domain name. These settings are located in WordPress Admin (https://[SERVER_IP]/wp-admin/
) -> Settings -> General
. Also, you will need to update the server_name
attribute in the Nginx site configuration files, otherwise WordPress will be unable to send email. Follow these steps:
vim /etc/nginx/conf.d/wordpress_http.conf
# Change the server_name underscore "_" to your domain name.
vim /etc/nginx/conf.d/wordpress_https.conf
# Change the server_name underscore "_" to your domain name.
service nginx restart
Removing wp-admin
Login Prompt
For servers created after 04/02/2015.
For security purposes, your WordPress app has an initial login prompt that opens when accessing the /wp-admin/
page. To remove this prompt, follow these steps.
- Login to your server using
ssh
as root. - Create a backup of your vhost files:
cp /etc/nginx/conf.d/*.conf /root/
- Edit both vhost files in
/etc/nginx/conf.d/
. You need to remove the block of code that starts withlocation ^~ /wp-admin/
. It is about 15 lines long. - Save your changes, and restart the web server:
service nginx restart && service php-fpm restart
https://www.vultr.com/docs/one-click-wordpress[/vc_toggle][vc_toggle title=”Install Let’s Encrypt SSL on One-Click WordPress App” style=”simple” color=”peacoc” custom_font_container=”tag:h2|font_size:16|text_align:left” custom_google_fonts=”font_family:ABeeZee%3Aregular%2Citalic|font_style:400%20regular%3A400%3Anormal” use_custom_heading=”true”]
Introduction
Let’s Encrypt is a certificate authority service that offers free TLS/SSL certificates. The process of installation is simplified by Certbot, a software client that automates most of the installation process. This tutorial shows how to install a Let’s Encrypt SSL certificate on the One-Click WordPress app.
https://www.vultr.com/docs/install-lets-encrypt-ssl-on-one-click-wordpress-app[/vc_toggle][vc_toggle title=”How To Optimize Nginx Configuration” style=”simple” color=”chino” custom_font_container=”tag:h2|font_size:16|text_align:left” custom_google_fonts=”font_family:ABeeZee%3Aregular%2Citalic|font_style:400%20regular%3A400%3Anormal” use_custom_heading=”true”]
Nginx
Nginx is a fast and lightweight alternative to the sometimes overbearing Apache 2. However, Nginx just like any kind of server or software must be tuned to help attain optimal performance.
Requirements
- A fresh Debian 7 droplet with the intial setup completed.
- The droplet must also have a freshly installed and configured Nginx server running. Try the Debian LEMP Stack tutorial, or for something a little more basic, try the Debian Nginx Server Blocks tutorial.
- A good understanding of Linux basics.
https://www.digitalocean.com/community/tutorials/how-to-optimize-nginx-configuration[/vc_toggle][vc_toggle title=”Increasing memory allocated to PHP” style=”simple” color=”mulled_wine” custom_font_container=”tag:h2|font_size:16|text_align:left” custom_google_fonts=”font_family:ABeeZee%3Aregular%2Citalic|font_style:400%20regular%3A400%3Anormal” use_custom_heading=”true”]
Increasing memory allocated to PHP
Also released with Version 2.5, the WP_MEMORY_LIMIT option allows you to specify the maximum amount of memory that can be consumed by PHP. This setting may be necessary in the event you receive a message such as “Allowed memory size of xxxxxx bytes exhausted”.
This setting increases PHP Memory only for WordPress, not other applications. By default, WordPress will attempt to increase memory allocated to PHP to 40MB (code is at the beginning of /wp-includes/default-constants.php) for single site and 64MB for multisite, so the setting in wp-config.php should reflect something higher than 40MB or 64MB depending on your setup.
WordPress will automatically check if PHP has been allocated less memory than the entered value before utilizing this function. For example, if PHP has been allocated 64MB, there is no need to set this value to 64M as WordPress will automatically use all 64MB if need be.
Please note, this setting may not work if your host does not allow for increasing the PHP memory limit–in that event, contact your host to increase the PHP memory limit. Also, note that many hosts set the PHP limit at 8MB.
Increase PHP Memory to 64MB
define( ‘WP_MEMORY_LIMIT’, ’64M’ );
Increase PHP Memory to 96MB
define( ‘WP_MEMORY_LIMIT’, ’96M’ );
Administration tasks require much memory than usual operation. When in the administration area, the memory can be increased or decreased from the WP_MEMORY_LIMIT by defining WP_MAX_MEMORY_LIMIT.
define( ‘WP_MAX_MEMORY_LIMIT’, ‘256M’ );
Please note, this has to be put before wp-settings.php inclusion.
https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP[/vc_toggle][vc_toggle title=”To Do List before Web Completion ” style=”simple” color=”pink” custom_font_container=”tag:h3|font_size:16|text_align:left|color:%238224e3″ custom_google_fonts=”font_family:ABeeZee%3Aregular%2Citalic|font_style:400%20regular%3A400%3Anormal” use_custom_heading=”true”]改Contact form email
由我地email 改做客人email
改woo commercial email (位置setting -> email & product -> inventory)
由我地email 改做客人email
Delete Post & Page
唔要0既page & Post
Delete Post Tags & Categories
唔要0既Tags & Categories
Delete 購買紀錄
testing 0既購買紀錄
Delete Media
唔要0既相
要取消唔俾Search Engine 搵到
Search Engine Visibility – Discourage search engines from indexing this site
更改Email 0既內容英轉中
第一次開account 後要變更密碼之後0既通知密碼
[/vc_toggle][/vc_column][/vc_row]