命令 |
内容 |
参数 |
备注 |
tar -zxvf xxx.tar.gz |
解压文件 |
-zxvf |
|
参考
- 安装依赖库gcc等
- yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
- 下载 pcre
- 编译 pcre
- tar zxvf pcre-8.35.tar.gz
- cd pcre-8.35
- ./configure
- make && make install
- pcre-config --version
- 下载 nginx
- 编译 nginx
- mkdir /usr/local/webserver
- cd /usr/local/webserver/
- mkdir nginx
- cd /usr/local/src/nginx-1.6.2
- ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35
- make && make install
- /usr/local/webserver/nginx/sbin/nginx -v
- nginx 配置文件
- vi /usr/local/webserver/nginx/conf/nginx.conf
- 默认配置
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
#gzip on;
upstream mytomcats {
server localhost:8081;
server localhost:8082;
}
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://mytomcats;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
- 检查配置文件 nginx.conf 的正确性命令
- /usr/local/webserver/nginx/sbin/nginx -t
- Nginx 命令
- 启动
- /usr/local/webserver/nginx/sbin/nginx
- 停止
- /usr/local/webserver/nginx/sbin/nginx -s stop
- 重新加载
- /usr/local/webserver/nginx/sbin/nginx -s reload