其他知识点: 在linux 上可以自行配置关于 关于linux的制品库
- 修改hosts /etc/hosts 添加: ip地址 域名 目的是为了可以访问域名
- 新增yum源 在/etc/yum.reposd/ 在该目录下添加 制品地址文件域名名称.repo 内容添加
[centos] name=制品地址文件域名名称 basurl="" enabled=1 gpgcheck=0
- 清理缓存,生成缓存 yum clean all yum makecache yum install -y patch
-
给nginx打补丁 需要安装 patch指令,安装方式如上流程
-
下载补丁包如ngx_http_proxy_connect_module.tar 上传到之前的安装目录上如我们可以上传到/nginx/install_packages/目录下,然后对这个模块解压
-
然后进入到nginx之前解压安装的目录, cd /nginx/install_package/nginx-1.2.0,然后我们执行 patch -p1< /nginx/install_packages/ngx_http_proxy_connect_module/patch/proxy_connect_rewrite_1080.patch 然后我们在执行指令 ./configure--user=nginx--prefix=/nginx/nginx --witch-openssl=/nginx/install_paclges/zlib/ --with-http_stub_statuss_module --with-http_ssl_module --with-stream --add-module=/nginx/install_packages/ngx_http_proxy_connect_modulle 然后我们执行 make指令即可!
-
替换原来的启动文件nginx cp /objs/nginx /nginx/nginx/sbin/nginx
- 启动指令 sudo /nginx/nginx/sbin/nginx 关于启动我们知道,通常只用root(端口小于1024) 权限的用户权限启动,但是这种的启动方式是不符合安全要求的,因此我们在安装nginx服务器的时候,要创建一个nginx的用户用来安装或者用root安装然后在切换用户和用户组也是可以的 关于nginx的配置
配置dns域名解析地址是在 vi /etc/resolv.conf 这里面添加dns的解析地址
user nobody; #
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include 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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
server_tokens off;
#dns 解析的配置
resolver dns的解析地址 ipv6=off;
#代理的配置
proxy_connect;
proxy_connect_allow 443 80;
proxy_connect_connect_timeout 50s;
proxy_connect_read_timeout 50s;
proxy_connect_send_timeout 50s;
#charset koi8-r;
#日志输出的内容,access是个定义的变量
log_format access ''
# $request_uri 代表的是请求的url
#
# 代表的是日志记录的位置 logs/host.access.log可以是一个绝对路径
access_log logs/host.access.log access;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_vary on;
#正向代理 转出, 如果获取请求头上的header 使用$http_header中命名的方式 的方式去获取
location /http {
if ($http_token != '') {
return 401;
}
proxy_pass 转出的路径
proxy_pass $schme $request_uri
}
location / {
root html;
index index.html index.htm;
}
location /download {
if ( $request_uri ~* ^/download/\?key\=edm$ ) {
rewrite ^(.*)$ /log;
}
rewrite ^(.*)$ /50x.html;
}
location ^~ /static/{
alias D:/static/;#指定图片存放路径
}
location ^~ /ebdc/attachment/{
#这个是判定url后缀中如果不携带这些字眼就不让通过的判断
if ($request_uri ~* .*\.(?!(jpg|png|jpeg|gif))) {
return 403;
}
alias D:/pictures/;#指定图片存放路径
}
location = /log {
alias D:/install_all;
autoindex on;
autoindex_exact_size off;
#allow 10.0.16.67;
#deny all;
}
#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 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;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}