代码拉取完成,页面将自动刷新
四项确认
1. 确认系统网络
ping www.baidu.com
2. 确认yum可用
yum list|grep gcc
3. 确认关闭iptables规则
iptables -F
4. 确认关闭selinux
setenforce 0
5. 安装依赖
yum -y install gcc gcc-c++ autoconf pcre pcre-devel make automake
yum -y install wget httpd-tools vim
1. IO多路复用epoll
2. 轻量级
3. CPU亲和(affinity)
4. sendfile
指定nginx官方提供的yum源
sudo vim /etc/yum.repos.d/nginx.repo
输入一下文本
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
yum list | grep nginx nginx的版本源
ps:这里系统用的是centos6 相关版本请自行修改
yum install nginx
nginx -v 判断是否安装成功
nginx -V 查看所有nginx的模块
rpm -ql nginx
/etc/logrotate.d/nginx Nginx日志轮转。用于logrotate服务日志切割
/etc/nginx Nginx主要配置文件
/etc/nginx/nginx.conf
/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf
/etc/nginx/fastcgi_params cgi配置 fastcgi配置
/etc/nginx/scgi_params
/etc/nginx/uwsgi_params
/etc/nginx/koi-utf Nginx编码转换的映射文件
/etc/nginx/koi-win
/etc/nginx/win-utf
/etc/nginx/mime.types 设置http的Content-Type扩展名对应关系
/etc/sysconfig/nginx centos7开始用于配置系统守护进程管理方式
/etc/sysconfig/nginx-debug
/usr/lib/systemd/system/nginx-debug.service
/usr/lib/systemd/system/nginx.service
/etc/nginx/modules Nginx模块目录
/usr/lib64/nginx/modules
/usr/sbin/nginx Nginx服务启动管理的终端命令
/usr/sbin/nginx-debug
/usr/share/doc/nginx-1.12.1 Nginx手册和帮助文档
/usr/share/doc/nginx-1.12.1/COPYRIGHT
/usr/share/man/man8/nginx.8.gz
/var/cache/nginx Nginx缓存目录
/var/log/nginx Nginx日志目录
--prefix=/etc/nginx
--sbin-path=/usr/sbin/nginx
--modules-path=/usr/lib64/nginx/modules
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx.pid
--lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp
--user=nginx
--group=nginx
--with-cc-opt=parameters
--with-ld-opt=parameters
nginx.conf
user nginx; 设置nginx服务的系统使用用户
worker_processes 1; 工作进程数
error_log /var/log/nginx/error.log warn; nginx的错误日志
pid /var/run/nginx.pid; nginx服务的pid
events {
worker_connections 1024; 每个工程允许最大连接数
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
default.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
模拟请求命令 curl http://www.imooc.com 返回请求所有信息 curl -v http://www.imooc.com >/dev/null 返回请求头信息
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。