阿里云ECS和WorldPress + Nginx实现固定连接策略
哈喽,大家好,我叫人宅。
这一节我们来讲解一下wolrdpress+Nginx如何在ECS上实现固定连接:
1.首先我们打开nginx.conf
2.将如下的代码 放在nginx.conf里面
if (-f $request_filename/index.html){rewrite (.*) $1/index.html break;}
if (-f $request_filename/index.php){rewrite (.*) $1/index.php;}
if (!-f $request_filename){rewrite (.*) /index.php;}
3.如下:
# power by www.php.cn
#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;#tcp_nodelay on;fastcgi_connect_timeout 300;fastcgi_send_timeout 300;fastcgi_read_timeout 300;fastcgi_buffer_size 128k;fastcgi_buffers 4 128k;fastcgi_busy_buffers_size 256k;fastcgi_temp_file_write_size 256k;#gzip on;gzip on;gzip_min_length 1k;gzip_buffers 4 32k;gzip_http_version 1.1;gzip_comp_level 2;gzip_types text/plain application/x-javascript text/css application/xml;gzip_vary on;gzip_disable "MSIE [1-6].";server_names_hash_bucket_size 128;client_max_body_size 100m; client_header_buffer_size 256k;large_client_header_buffers 4 256k;server {listen 80;server_name localhost;#charset koi8-r;#access_log logs/host.access.log main;root "C:/phpStudy/PHPTutorial/WWW";location / {index index.html index.htm index.php l.php;autoindex off;
if (-f $request_filename/index.html){rewrite (.*) $1/index.html break;}
if (-f $request_filename/index.php){rewrite (.*) $1/index.php;}
if (!-f $request_filename){rewrite (.*) /index.php;}}#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(.*)$ {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;fastcgi_param PATH_INFO $fastcgi_path_info;fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;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;# server_name localhost;# ssl on;# ssl_certificate cert.pem;# ssl_certificate_key cert.key;# ssl_session_timeout 5m;# ssl_protocols SSLv2 SSLv3 TLSv1;# ssl_ciphers HIGH:!aNULL:!MD5;# ssl_prefer_server_ciphers on;# location / {# root html;# index index.html index.htm;# }#}include vhosts.conf;}
4.点击保存。重启Nginx后在固定 ,重新设置固定连接,即可实现该效果:
阿里云ECS和WorldPress + Nginx实现固定连接策略相关推荐
- 阿里云ECS服务器搭建Nginx+PHP+MySql+Redis环境详细步骤(CentOS7环境)
参考了很多别人总结的经验,没有版权,欢迎转载 ^ ^ 一.安装Nginx 1.下载nginx-release包 wget http://nginx.org/packages/centos/7/noar ...
- 阿里云ECS上环境搭建(virtualenv+flask+gunicorn+supervisor+nginx)
阿里云ECS目前有新用户免费半年使用的活动,就利用闲暇时间申请了一台,具体申请可到http://free.aliyun.com/?spm=5176.383518.1.28.OXp5YZ. 我选择的配置 ...
- nginx管理面板_吸塑包装自建网站上线,阿里云ecs+bt面板+WordPress
吸塑包装网站搭建是我经过对比了织梦dede.帝国和WordPress后选择了WordPress,从本地搭建的apache搬迁到阿里云ecs服务器. 第一步,为了后期多网站的管理,安装了宝塔面板,做了域 ...
- 阿里云ECS服务器安装Nginx
前言: 阿里云Ecs服务器部署项目,尤其是对于前后端分离的项目,之前在博客中提到相关SpringBoot部署到服务器: (35条消息) SpringBoot部署到阿里云服务器_最爱吃大米的博客-CSD ...
- python-django 阿里云ECS服务器部署uwsgi+nginx过程解说
需求:在本地已经完成了一个博客系统/数据可视化系统的开发,需要部署到系统上,展示个人主页/个人作品 编程语言:Python 系统框架:Django 数据库:MySQL 服务架构:uwsgi+nginx ...
- Nginx+Docker+Jekyll+阿里云ECS+备案搭建博客全记录
"记录本站搭建全过程,为想要自己搭建博客的朋友提供一个参考" 在我的博客网站中查看本文 前言与准备 Docker Docker是一个很方便的跨平台应用容器引擎,让开发者可以打包他们 ...
- 阿里云ECS(Centos)中Nginx安装及配置
Nginx是一个高性能的http和反向代理web服务器,本篇在记录阿里云ECS中安装及配置Nginx的过程.Nginx作为系统关键服务,下面流程全部在root用户下完成. 系统:CentOS 8.0 ...
- 阿里云ECS服务器购买及配置,SpringBoot项目部署到阿里云ECS服务器,阿里云ECS服务器安装JDK、Mysql、nginx详细步骤
1.购买阿里云ECS服务器 官网:阿里云-上云就上阿里云 根据自己的需要选择相应的配置: 目前有一个月的服务器免费体验时间,我选择了免费体验,点击后,可以看到你刚才购买的服务器: 也可以通过这里查看你 ...
- 云主机配置微信公众号后台全记录 --【 阿里云ECS CentOS7 + Python3 + Flask + Nginx + Gunicorn + WeRoBot + Systemd 】
前言 在天秤座的纠结性格反复权衡后,最终我还是拥有了自己的第一个个人云主机.我这里选择的是"阿里云学生专享服务器",在做学生的最后一年有幸享受到9.5/月的优惠价格,还是要感谢阿里 ...
- 阿里云域名解析网络和服务架构设计(四) 之阿里云ECS服务器Nginx代理实践
一.回顾 阿里云域名解析网络和服务架构设计总概览(一)_飞鸽FlyGo的博客-CSDN博客云解析DNS.负载均衡SLB.阿里云ECS服务器.阿里云ECS服务器Nginx代理https://flygo. ...
最新文章
- vue中使用baidushare分享到微信无法显示bug解决方案
- 条码扫描枪----针对MS3391扫码器的工作原理
- 我的2013-从GIS学生到GIS职业人的飞跃
- flex 布局以及样式
- 传统企业装上“智慧大脑” 看阿里巴巴如何实践AI赋能
- 通过kubernetes release制作k8s rpm包
- servlet笔试题java,Java推荐!Servlet面试题和答案汇集
- 【精品毕设】电力电子仿真——母线继电保护动作行为仿真分析系统
- 机器学习(3)--LR算法
- OpenCV-直方图
- CAD二次开发C#——动态绘制矩形(DrawJig)
- QQ空间技术架构之深刻揭秘
- 身高预测c语言代码switch,C++ ,预测身高程序
- AI视频智能平台EasyCVR设备录像出现无法播放现象的问题修复
- 插入排序(直接插入排序,折半插入排序,希尔排序)
- php iphone图片旋转图片,php识别翻转iphone拍摄的颠倒图片
- 我的世界服务器显示披风指令,我的世界电脑披风指令 | 手游网游页游攻略大全...
- 【转】Ceph对象存储(rgw)的IPv6环境配置
- CAD版本怎么转换?试试这种方法
- 【无人机】【2019.07】未来无线网络中多个无人机基站的定位
热门文章
- Dell intel i5 1135笔记本 win10 ubuntu18.04双系统
- 导出anaconda的代码为pdf
- 微信分享图标设置,以及wx.config配置
- lego-loam在Ubuntu16.04下安装、跑包及实时建图
- 微信自动加好友可以使用python实现
- 快狗打车,打车新平台,这个猛!
- Android9 点击按键KeyEvent.KEYCODE_CAMERA没反应
- 参考 | 升级 Win11 移动热点开不了或者开了连不上
- 采用软改的方式激活Windows 7
- install index.php,安装好的织梦dedecms首页index.php自动跳转到install/index.php的问题