nginx 反向代理以及 location /admin/
nginx 反向代理以及 location /admin/
反向代理时, 需要特别注意
,本地测试时确保类似IP调用 127.0.0.1:8082/admin 这种情况可以直接访问,在做反向代理。否则请使用测试域名访问,反向代理才可以成功,最好设置相关header头,跳转的才可以使用。
// 常规
server {listen 8280;server_name angelsteward.test *.angelsteward.test;root "E:/own/git/angelsteward/public/";index index.html index.htm index.php;location / {try_files $uri $uri/ /index.php$is_args$args;autoindex on;}location ~ \.php$ {include snippets/fastcgi-php.conf;fastcgi_pass php_upstream; #fastcgi_pass unix:/run/php/php7.0-fpm.sock;}charset utf-8;location = /favicon.ico { access_log off; log_not_found off; }location = /robots.txt { access_log off; log_not_found off; }location ~ /\.ht {deny all;}
}// 反向代理
server {listen 8280;server_name angelsteward.test *.angelsteward.test;location / {root "C:\Users\Y\Desktop\18token\18token.im";index index.html index.htm index.php; autoindex on;}location /admin { #alias "E:/own/git/cim/public/"; proxy_pass http://127.0.0.1:8082;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-NginX-Proxy true;#try_files $uri $uri/ /index.php$is_args$args;#index index.html index.htm index.php; #autoindex on; } location ~ \.php(.*)$ {include snippets/fastcgi-php.conf;fastcgi_pass php_upstream; #fastcgi_pass unix:/run/php/php7.0-fpm.sock;}charset utf-8;location = /favicon.ico { access_log off; log_not_found off; }location = /robots.txt { access_log off; log_not_found off; }location ~ /\.ht {deny all;}
}// ssh 443 https
server {listen 4430 ssl;
# listen 443;server_name angelsteward.test *.angelsteward.test;
# ssl on;ssl_certificate E:\own\git\https\server.pem;ssl_certificate_key E:\own\git\https\privkey.pem;ssl_session_timeout 5m;ssl_protocols SSLv2 SSLv3 TLSv1;ssl_ciphers HIGH:!aNULL:!MD5;ssl_prefer_server_ciphers on;root "E:/own/git/angelsteward/public/";index index.html index.htm index.php;location / {try_files $uri $uri/ /index.php$is_args$args;autoindex on;}location ~ \.php$ {include snippets/fastcgi-php.conf;fastcgi_pass php_upstream; #fastcgi_pass unix:/run/php/php7.0-fpm.sock;}charset utf-8;location = /favicon.ico { access_log off; log_not_found off; }location = /robots.txt { access_log off; log_not_found off; }location ~ /\.ht {deny all;}
}# This file is auto-generated.
# If you want Laragon to respect your changes, just remove the [auto.] prefix
# If you want to use SSL, enable it at: Menu > Nginx > SSL > Enabled
重点
alias 关键字,在此处是通过 / 根目录访问静态网页。/admin 访问 php 项目,此处由于原 laravel 项目域名路由已经定义 admin 路径冲突,只能使用反向代理配置。
这种情况应该是适用于 php 项目已有 /admin 子目录时且已经是适配 /admin 的路由,或者是类似 /api 的路由配置,才可以进行目录跳转适配。否则产生错误404。
即反向代理用户多个不同的项目部署于一个域名下。
alias 用于项目(多个)下的多个模块区分,比如 前后端、api 分离 的路由指定。
在做 https ssh 443 的配置时,暂可以忽略其他配置。
nginx 反向代理以及 location /admin/相关推荐
- Nginx反向代理之location
划重点.这里是个坑 location /forum/ { proxy_pass http://a.com/; //最后的斜线不能少 } http://b.com/forum/ –> http:/ ...
- linux nginx反向代理配置
linux nginx反向代理配置 location ^~/api/ {proxy_pass http://192.168.1.50:82/; }
- nginx反向代理打印日志_nginx反向代理笔记
课前回顾 mysqladmin -uroot password 1#给root用户密码(必须要做) mysql -uroot -p1 create database wp;#创建数据库 create ...
- Nginx反向代理 实现Web负载均衡
实现负载均衡的方式有很多种,DNS.反向代理.LVS负载均衡器(软件实现).F5(负载均衡器,硬件,非常昂贵)这里我们只提到基于DNS,以及反向代理的方式来实现负载均衡Web服务 DNS服 ...
- 使用nginx反向代理发起跨域请求
任务5:http://www.jnshu.com/task/2/45/detail//#1 页面文件放在github:https://github.com/Resalee/css_task/tree/ ...
- nginx反向代理实现二级域名转一级域名
需求场景: 有两个大项目交互必须在一级域名下,每个项目有多个前端,之前采用二级或三级域名的方式导致域名过多不好维护,故由project1.service1.city.com.project1.serv ...
- Gerrit安装及使用Nginx反向代理
Gerrit安装及使用Nginx反向代理 简介 Gerrit做为Google用来管理Android代码版本的工具,是一种免费.开放源代码的代码审查软件,使用网页界面.本文主要介绍它的安装步骤. 一.准 ...
- 使用Nginx反向代理tomcat服务器
使用Nginx反向代理tomcat服务器 2015-04-23 11:19 244人阅读 评论(0) 收藏 举报 分类: Tomcat(5) LNMP/LAMP开发平台研究(10) 版权声明: ...
- Tomcat系列之服务器的基本配置及Nginx反向代理tomcat服务
大纲 一.Tomcat 基本配置 1.为Tomcat提供SysV脚本 2.catalina 脚本讲解 3.telnet 登录管理Tomcat 4.配置Tomcat虚拟主机 5.Tomcat图形管理接口 ...
最新文章
- ASP.NET学习6 XML文档的操作
- 解析BW:数据源提取数据的原理
- ux设计师薪水_我是如何从33岁的博物馆导游变成专业的Web开发人员和UX设计师的:我的…...
- mysql-8.0.16-winx64.zip安装教程
- 【Java 网络编程】网络通信原理、TCP、UDP 回显服务
- Linux虚拟机添加新硬盘的全程图解
- python fortran混编 ctypes_Python调用C/Fortran混合的动态链接库--上篇
- 写项目总结写哪些方面
- 【美团校招在线考试笔试题】钱币面值组合
- 基于java的在线医院挂号系统设计(含源文件)
- 【Android】蓝牙开发——经典蓝牙:配对与解除配对 实现配对或连接时不弹出配对框
- 算法设计与分析(python版)-作业三
- Android内存动态加载Dex
- javascript 中搜索数组的四种方法
- python手机群控(adb命令)实现
- ArcMap突然无法打开
- python 第七周
- HTML之CSScontent宽度和高度
- flash跨域修复建议
- 修改host文档来连接服务器,Host文件是什么?要如何修复?