http://nginx.org/en/download.html (stable version)
解压到一个目录
配置文件放在上图的conf目录
修改nginx.conf
#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;keepalive_timeout 65;server {listen 80;server_name api.imqianduan.com;location / {proxy_pass http://127.0.0.1:8000;}}}
nginx配置了域名反向代理,这时还是打不开,还必须设置本地host(就像线上域名要解析到一个IP一样)
127.0.0.1 api.imqianduan.com
nginx.exe即可,任务管理器中会多两个进程
如果要关掉进程,可以先关第二个再关第一个
http或https不带www的域名301跳转到带www的URL
需要跨域的项目,很多时候每次都会发送OPTIONS请求,能不能优化呢?
win10下安装nginx,配置返向代理
以腾讯云为例,配置nginx,实现https访问
nginx设置二级域名指向子目录
发现ip访问比nginx快多了,知道nginx出问题了~ 得给他优化优化。优化后由原来的2.7s打开,到600ms打开~nginx优化还是有用的
通过nginx开启gzip设置
nginx服务端实现CORS跨域配置
今天想对一个问题进行分析和讨论,就是关于爬虫对网站页面爬取的问题,有些网站通过爬虫去采集其它的网站页面信息作为己用,大量的爬取行为会对web服务器有比较性能有影响,主要的表现就是会变得很慢。