标签:point justify mime apache RKE window push 加载 9.1
Web服务器Nginx的安装与配置卸载老版本的Nginx
sudo apt-get --purge remove nginxsudo apt-get autoremove
dpkg --get-selections|grep nginx//将罗列出与nginx相关的软件,如nginx-common一并删除sudo apt-get --prege remove nginx-common1234
安装Nginx
tar -zxvf nginx-1.10.2.tar.gzcd nginx-1.10.2.tar.gz
./configure //注意终端中的信息,缺少库文件要记得安装在重新configure才行
make
sudo make install12345
Nginx反向代理配置
server {
listen 8001;
server_name localhost;
charset utf-8;
access_log /home/codemap.access.log;
location / {
proxy_set_header X-Forwarded-For $remote_addr</span><span class="pun">;</span></code></li><li class="L9"><code><span class="pln"> proxy_set_header </span><span class="typ">Host</span><span class="pln"> $http_host;
proxy_pass http://127.0.0.1:8000;
}
}12345678910
worker_processes 4; //进程数,一般等于电脑cpu内核数events {
worker_connections 1024;//最大链接数}
http {//配置文件根目录
include mime.types;
default_type application/octet-stream;
sendfile on; #tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; #gzip on;
include codemap.conf;//引入的配置文件}1234567891011121314
常用命令
重启nginx:/usr/local/nginx/sbin/nginx -s reopen1重新加载配置文件:/uar/local/nginx/sbin/nginx -s reload 1启动:/uar/local/nginx/sbin/nginx1关闭:/uar/local/nginx/sbin/nginx -s stop1
进程管理工具supervisor安装
终端安装
apt-get install supervisor1
supervisor配置
[program:GGYun]directory = /home/noah/Documents/src/github.com/HivenKay/GGYun //项目路径command = /home/noah/Documents/src/github.com/HivenKay/GGYun/GGYun //可执行二进制文件路径autostart = true //是否制动启动autorestart=true //是否自动重启startsecs = 5user = root //执行用户redirect_stderr = truestdout_logfile = /var/log/supervisord/GGYun.logstderr_logfile =/var/log/supervisord/ghost_err.log12345678910
supervisor常用命令
supervisorctl start GGYun//启动进程1supervisorctl restart GGYun//重启进程1supervisorctl reload //重启supervisorctl1
supervisor安装后可能遇到的问题
sudo touch /var/run/supervisor.sock1sudo chmod 777 /var/run/supervisor.sock1sudo service supervisor restart1
连接远程服务器
ssh root@139.196.180.208 //root为用户名,139.196.180.208为服务器的ip1
scp /home/noah/Documents/... root@139.196.180.208:/home/noah/Documents/...
[3]supervisor使用管理:实现对异常中断子进程的自动重启(以nginx和apache为例)
标签:point justify mime apache RKE window push 加载 9.1
原文地址:http://blog.51cto.com/sf1314/2131625