比如百度联盟需要配置验证文件
1.编辑nginx.config配置文件
vi nginx.config
在80和443的 server{}中添加以下配置
http 80端口配置
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
proxy_pass http://a.com;
proxy_redirect default;
}
location = /bdunion.txt {
default_type text/plain;
return 200 'a119c0bfd12c7baa8325b2f698897d00';
}
}
https 443端口配置
server {
listen 443 ssl;
server_name localhost;
ssl_certificate test.crt;
ssl_certificate_key test.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;
proxy_pass http://a.com;
proxy_redirect default;
}
location = /bdunion.txt {
default_type text/plain;
return 200 'a119c0bfd12c7baa8325b2f698897d00';
}
}
2.重新加载nginx
cd sbin
./nginx -s reload