Linux之源码安装nginx,并按照作业一描述的那样去测试使用

时间:2023-02-05 14:42:08

作业五:源码安装nginx,并按照作业一描述的那样去测试使用

[root@localhost nginx]# yum install gcc-* glibc-* openssl openssl-devel pcre pcre-devel zlib zlib-devel -y

[root@localhost nginx]# wget -q http://nginx.org/download/nginx-1.10.3.tar.gz

[root@localhost nginx]# ls nginx-1.10.3.tar.gz

nginx-1.10.3.tar.gz

[root@localhost nginx]# tar -xf nginx-1.10.3.tar.gz

[root@localhost nginx]# cd nginx-1.10.3/

[root@localhost nginx]# ./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module

[root@localhost nginx]# make && make install

# 配置nginx.conf

[root@localhost nginx]# cat /usr/local/nginx/nginx.conf|egrep -v "^$|^#|#"

worker_processes  1;

events {

worker_connections  1024;

}

http {

include       mime.types;

default_type  application/octet-stream;

sendfile        on;

keepalive_timeout  65;

server {

listen       80;

server_name  localhost;

location / {

root   /data/www/html;

index  index.html index.htm;

}

error_page   500 502 503 504  /50x.html;

location = /50x.html {

root   html;

}

}

}