java多线程    Java入门    vsftp    ftp    linux配置    centos    FRP教程    HBase    Html5缓存    webp    zabbix    分布式    neo4j图数据库    

Linux 安装nginx

ubuntu
vi /etc/apt/source.list
加入下面两句话
deb http://nginx.org/packages/ubuntu/ lucid nginx
deb-src http://nginx.org/packages/ubuntu/ lucid nginx

apt-get update
apt-get install nginx

vi /etc/nginx/nginx.conf
负载均衡配置

worker_processes 1;
events {
worker_connections 1024;
}
http{
upstream myproject {
#这里指定多个源服务器,ip:端口,80端口的话可写可不写
server 192.168.43.158:80 weight=2;
server 192.168.41.167 weight=3;
}
server {
listen 8080;
location / {
proxy_pass http://myproject;
}
}
}

worker_rlimit_nofile 44800;
events
{
use epoll;
worker_connections 44800;
}

nginx 的cookie 多台机器是共享cookie的。因为cookie是写在用户客户端的。
session的话,就涉及到多台机器同步session问题了。


This entry was posted in Linux and tagged . Bookmark the permalink.
月小升QQ 2651044202, 技术交流QQ群 178491360
首发地址:月小升博客https://java-er.com/blog/linux-nginx/
无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢
您的评论是我写作的动力.

Leave a Reply