标签:nginx
NGINX
在虚拟控制台把vm1的Memory改为2048,启动vm1
(1)安装 编译 软链接
77 cd / ###切换到文件包所在目录
78 ls
79 tar zxf nginx-1.12.0.tar.gz ###解压
80 ls
81 cd nginx-1.12.0 ###切换到解压后文件包的目录下
82 ls
84 pwd ###查看文件所在路径
85 useradd -M -d/usr/local/lnmp/nginx -s/sbin/nologin -u 800 nginx ##添加nginx用户
86 id nginx
87 ls
88 cd src
89 ls
90 cd core
91 ls
92 vim nginx.h 图
93 pwd
94 cd ..
95 ls
96 cd auto/
97 ls
98 cd cc/
99 ls
100 vim gcc 图
101 cd --
102 cd /nginx-1.12.0
103 ls
104 ./configure--prefix=/usr/local/lnmp/nginx --user=nginx --group=nginx --with-threads --with-file-aio--with-http_ssl_module --with-http_stub_status_module
105 yum install gcc pcre-developenssl-devel -y
106 ./configure--prefix=/usr/local/lnmp/nginx --user=nginx --group=nginx --with-threads --with-file-aio--with-http_ssl_module --with-http_stub_status_module
107 make && make install
108 cd /usr/local/lnmp/nginx/
109 ls
110 du -sh
111 cd sbin
112 ./nginx
113 ls
115 pwd
116 ln -s/usr/local/lnmp/nginx/sbin/nginx /sbin/
117 ls
118 which nginx
121 curl localhost -I
gcc文件
(2) 文件打开数
146 cd /usr/local/lnmp/
147 ls
148 cd nginx/
150 ls
151 cd conf
152 ls
153 vim nginx.conf
worker_processes 2;
worker_cpu_affinity 01 10;
154 nginx -t ####检测有没有语法错误
155 nginx -s reload ###更新配置
158 vim /etc/security/limits.conf
160 usermod -s /bin/bash nginx
161 su - nginx
2个CPU,开启2个进程
worker_processes 2;
worker_cpu_affinity 01 10;
01表示启用第一个CPU内核,10表示启用第二个CPU内核
worker_cpu_affinity 01 10;表示开启两个进程,第一个进程对应着第一个CPU内核,第二个进程对应着第二个CPU内核
(3) 共享文件
166 vim nginx.conf
167 nginx -t
168 vim nginx.conf
169 nginx -t
170 nginx -s reload
171 mkdir /web1
172 cd /web
173 cd /web1
174 vim index.html
测试结截图:真机
175 cd /usr/local/lnmp/
176 ls
177 cd nginx/
178 ls
179 cd conf
180 ls
182 vim nginx.conf
183 cd /etc/pki/tls/certs
184 ls
186 make cert.pem
187 ll cert.pem
188 mv cert.pem /usr/local/lnmp/nginx/conf/
189 cd /usr/local/lnmp/nginx/conf/
190 ls
191 nginx -t
192 nginx -s reload
193 netstat -antlp
配置文件:
48 location /status{
49 stub_status on;
50 access_log off;
51 allow 172.25.21.250;
52 deny all
109 server_name www.westos.org;
121 root web1;
129 rewrite ^(.*)$ https://www.westos.org permanent
测试:物理机,即真机
标签:nginx
原文地址:http://12778805.blog.51cto.com/12768805/1949915