安装
环境:ubuntu
安装:
sudo su
sudo apt-get install nginx
检查
nginx -v
启动
service nginx start
打开http://localhost就能看到nginx默认页面了
关闭
service nginx stop
完全卸载
apt-get --purge autoremove nginx
nginx文件安装完成之后的文件位置:
/usr/sbin/nginx:主程序
/etc/nginx:存放配置文件
/usr/share/nginx:存放静态文件
/var/log/nginx:存放日志
配置
打开/etc/nginx/nginx.conf文件,在http里面加上
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://nginx-A;
}
}
upstream nginx-A{
server localhost:9201 ;
server localhost:9202 ;
}