标签:src ima for lob linu name buffer .net errors
Nginx安装进入/usr/local/src目录下
[root@100xuni1 ~]# cd /usr/local/src/
下载Nginx安装包可以去nginx.org或者https://coding.net/u/aminglinux/p/resource/git/blob/master/README.md下载
[root@100xuni1 src]# wget http://124.205.69.170/files/51490000069A64B9/nginx.org/download/nginx-1.14.0.tar.gz ##wget下载
解压
[root@100xuni1 src]# tar zxf nginx-1.14.0.tar.gz ##解压
[root@100xuni1 src]# cd nginx-1.14.0/ ##解压完成后进入
编译
[root@100xuni1 nginx-1.14.0]# ./configure --prefix=/usr/local/nginx ##编译
make
[root@100xuni1 nginx-1.14.0]# make
make install
[root@100xuni1 nginx-1.14.0]# make install
nginx目录
[root@100xuni1 nginx-1.14.0]# ls /usr/local/nginx/ ##目录
conf html logs sbin
[root@100xuni1 nginx-1.14.0]# ls /usr/local/nginx/conf/ ##配置文件目录
fastcgi.conf fastcgi_params koi-utf mime.types nginx.conf scgi_params uwsgi_params win-utf
fastcgi.conf.default fastcgi_params.default koi-win mime.types.default nginx.conf.default scgi_params.default uwsgi_params.default
[root@100xuni1 nginx-1.14.0]# ls /usr/local/nginx/html/ ##样例文件
50x.html index.html
[root@100xuni1 nginx-1.14.0]# ls /usr/local/nginx/logs/ ##存放日志
[root@100xuni1 nginx-1.14.0]# ls /usr/local/nginx/sbin/ ##他的进程核心的文件
nginx
-t也是支持的查询配置文件是否有错
[root@100xuni1 nginx-1.14.0]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
给nginx创建配置文件还要给他做个启动脚本
[root@100xuni1 nginx-1.14.0]# vim /etc/init.d/nginx ##启动脚本存放位置,配置这个文件内容去https://coding.net/u/aminglinux/p/aminglinux-book/git/blob/master/D15Z/etc_init.d_nginx 把这里的内容拷贝到nginx里
改权限
[root@100xuni1 nginx-1.14.0]# chmod 755 /etc/init.d/nginx
开机启动
[root@100xuni1 nginx-1.14.0]# chkconfig --add nginx
[root@100xuni1 nginx-1.14.0]# chkconfig nginx on
编辑配置文件这个配置文件需要下载模板
[root@100xuni1 nginx-1.14.0]# cd /usr/local/nginx/conf/ ##进入配置文件
[root@100xuni1 conf]# ls ##这个里边nginx.conf了不用他的用自己的,
fastcgi.conf fastcgi_params koi-utf mime.types nginx.conf scgi_params uwsgi_params win-utf
fastcgi.conf.default fastcgi_params.default koi-win mime.types.default nginx.conf.default scgi_params.default uwsgi_params.default
[root@100xuni1 conf]# mv nginx.conf nginx.conf.1 ##拷贝改名字
开始配置
[root@100xuni1 conf]# vim nginx.conf ##去https://coding.net/u/aminglinux/p/aminglinux-book/git/blob/master/D15Z/nginx.conf下拷贝内容
user nobody nobody; ##用来启动nginx是哪些用户
worker_processes 2; ##定义子进程有几个
error_log /usr/local/nginx/logs/nginx_error.log crit; ##错误日志
pid /usr/local/nginx/logs/nginx.pid; ##pid
worker_rlimit_nofile 51200; ##nginx最多打开多少个文件
events
{
use epoll;
worker_connections 6000;
}
http
{
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 3526;
server_names_hash_max_size 4096;
log_format combined_realip ‘$remote_addr $http_x_forwarded_for [$time_local]‘
‘ $host "$request_uri" $status‘
‘ "$http_referer" "$http_user_agent"‘;
sendfile on;
tcp_nopush on;
keepalive_timeout 30;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
connection_pool_size 256;
client_header_buffer_size 1k;
large_client_header_buffers 8 4k;
request_pool_size 4k;
output_buffers 4 32k;
postpone_output 1460;
client_max_body_size 10m;
client_body_buffer_size 256k;
client_body_temp_path /usr/local/nginx/client_body_temp;
proxy_temp_path /usr/local/nginx/proxy_temp;
fastcgi_temp_path /usr/local/nginx/fastcgi_temp;
fastcgi_intercept_errors on;
tcp_nodelay on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 8k;
gzip_comp_level 5;
gzip_http_version 1.1;
gzip_types text/plain application/x-javascript text/css text/htm
application/xml;
server
{
listen 80;
server_name localhost;
index index.html index.htm index.php;
root /usr/local/nginx/html;
location ~ \.php$
{
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fcgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
}
}
}
[root@100xuni1 conf]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
启动
[root@100xuni1 conf]# /etc/init.d/nginx start
46次课(Nginx安装 、 默认虚拟主机、Nginx用户认证、Nginx域名重定向)
标签:src ima for lob linu name buffer .net errors
原文地址:http://blog.51cto.com/8043410/2159486