linux Nginx服务的安装及使用

服务安装

通过rpm包安装

压缩包nginx-1.14.0.tar.gz解压

进入目录nginx-1.14.0

编辑文件nginx-1.14.0/auto/cc/gcc :

 注释掉171和172行:

解决依赖性

yum install   gcc  pcre-devel  openssl-devel -y

安装

./configure --prefix=/usr/local/nginx   --with-http_ssl_module --with-http_stub_status_module --with-threads --with-file-aio

没有报错后执行make  make  install

2 配置文件

nginx打开服务

编辑nginx的配置文件/usr/local/nginx/conf/nginx.conf :

第3行设定进程数为2,第4行指定工作cpu关系为01 10

 18行写apache的工作组,为两个服务器

创建nginx用户nginx:useradd -M -d /usr/local/nginx  nginx

在limits.conf中限制用户

nginx -s reload 重新加载配置文件

两台rsa服务器打开httpd服务 

在浏览器所在主机增加解析   172.25.15.7  www.westos.org

测试结果

nginx服务的默认发布目录为/usr/local/nginx/html。

在这个目录里写入测试文件test.html。

在配置文件/usr/local/nginx/conf/nginx.conf中,将VS以备份的形式写入wetsos组:

在nginx的默认发布目录下,将原有的index.html文件移动到其他目录中,将新建的test.html文件重命名为index.html。之后 重新加载nginx服务。这样,在两个RS服务都停掉的情况下,解析www.westos.org域名就可以解析到VS端的内容,可以在这个新建的 index.html文件中写入该网站正在维护等相关信息,表示后台服务器无法提供正常服务:

3 cookies

对nginx重新配置

关闭旧nginx 

打开浏览器  f12  添加stronge  可以看到cookies信息

猜你喜欢

转载自blog.csdn.net/iaMay_____/article/details/81329527