ZeroNet Blogs

Static ZeroNet blogs mirror

基本环境:

1. 服务器:BANDWAGON,10G,512M,CENTOS6.5; 2. 本地:WIN10-64b,PUTTY;

安装过程:

PUTTY,ROOT LOGIN;

yum update yum groupinstall "Development Tools" yum install wget yum install nginx nginx -v cd /etc/nginx/conf.d rm default.conf vi ghost.conf

server {
  listen 80;
  server_name domain.com;
  location / {
      proxy_set_header   X-Real-IP $remote_addr;
      proxy_set_header   Host      $http_host;
      proxy_pass         <http://127.0.0.1:2368;>
      proxy_set_header REMOTE-HOST $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

service nginx restart chkconfig nginx on

yum install libtool automake autoconf gcc-c++ openssl-devel cd /tmp wget <http://nodejs.org/dist/v0.12.17/node-v0.12.17.tar.gz> tar -zvxf node-v0.12.17.tar.gz cd node* ./configure --prefix=/usr make make install node -v npm -v

cd /var/www wget <https://ghost.org/zip/ghost-latest.zip> -o ghost.zip unzip ghost.zip -d ghost cd ghost mv config.example.js config.js

==vi使用说明:s开始编辑,esc退出,:wq!保存并退出.==

vi config.js

production: {  
  url: 'http://domain.com',  
  mail: {},

npm install --production npm start --production ctrl+c

npm install pm2 -g NODE_ENV=production pm2 start index.js --name "ghost" pm2 startup centos pm2 save

==如果要用mysql,在npm install --production之前执行以下:==

yum install mysql mysql-server service mysqld start chkconfig mysqld on mysql_secure_installation

==y,y,n,y,y==

vi /etc/my.cnf

[client]
default-character-set=utf8  
[mysql]
default-character-set=utf8  
[mysqld]
character-set-server=utf8  
collation-server=utf8_general_ci

mysql -u root -p create database ghost; GRANT ALL PRIVILEGES ON ghostdata.* To 'ghost'@'%' IDENTIFIED BY '123456';   

ghostdata是数据库,ghost是用户名,123456是密码

FLUSH PRIVILEGES;

vi config.js

production: {  
    url: 'domain.com',
    mail: {},
    database: {
        client: 'mysql'
        connection: {
            host     : '127.0.0.1',
            user     : 'ghost',
            password : '123456',
            database : 'ghostdata',
            charset  : 'utf8'
        },
    server: {
            host: '127.0.0.1',
            port: '2368'
        }
    }

SS

shadowsocks

wget --no-check-certificate <https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks.sh>

chmod +x shadowsocks.sh ./shadowsocks.sh 2>&1 | tee shadowsocks.log

SS卸载

./shadowsocks.sh uninstalls

SS多用户配置方案

vi /etc/shadowsocks.json

{  
"server":"0.0.0.0",  
"local_address":"127.0.0.1",  
"local_port":1080,  
"port_password":{  
"10086":"123456",  
"10087":"123456",  
"10088":"123456",  
"10089":"123456",  
"10090":"123456"  
},  
"timeout":600,  
"method":"aes-256-cfb",  
"fast\_open": true  
}

SS管理

/etc/init.d/shadowsocks start /etc/init.d/shadowsocks stop /etc/init.d/shadowsocks restart /etc/init.d/shadowsocks status

SS加速

==net-speeder:==

cd /tmp wget <http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm> rpm -ivh epel-release-X-Y.noarch.rpm yum install libnet libpcap libnet-devel libpcap-devel wget <https://github.com/snooda/net-speeder/archive/master.zip> unzip master.zip cd net-* chmod +x build.sh sh build.sh cp ./net_speeder /usr/bin

ifconfig#确定网卡名

/usr/bin/net_speeder eth0 "000.000.000.000" >/dev/null 2>&1 &#启动

echo '/usr/bin/net_speeder eth0 "000.000.000.000" >/dev/null 2>&1 &' >> /etc/rc.local#开机启动

==开启Hybla(非openvz使用)==

sysctl net.ipv4.tcp_available_congestion_control sysctl net.ipv4.tcp_congestion_control=hybla vi sysctl.conf

net.ipv4.tcp_congestion_control = hybla

==tcp优化==

vi /etc/security/limits.conf

* soft nofile 51200  
* hard nofile 51200

ulimit -n 51200 vi /etc/sysctl.conf

fs.file-max = 51200  
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.netdev_max_backlog = 250000
net.core.somaxconn = 3240000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.ipv4.tcp_mtu_probing = 1

sysctl -p /etc/init.d/shadowsocks restart