Nginx配置ThinkPHP和Laravel虚拟主机
ThinkPHP
server {
listen 443 ssl;
server_name abc.com;
root /var/www/abc; ssl on;
ssl_certificate /etc/nginx/ssl/abc.pem;
ssl_certificate_key /etc/nginx/ssl/abc.pem; index index.php; location / {
#ThinkPHP REWRITE支持
if (!-e $request_filename) {
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^/(.*)$ /index.php?s=$1 last;
} } location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; } access_log /var/log/access.log;
error_log /var/log/error.log error; location ~ /.git {
return 404;
} location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/run/php/php7.0-fpm.sock;
} location ~ /\.ht {
deny all;
}
}
这里配置的是HTTPS,如果想配置HTTP的,只需要将端口改成80,然后去掉证书相关配置即可
Laravel
server {
listen 443;
server_name abc.com.cn;
root /var/www/abc/public; ssl on;
ssl_certificate /etc/nginx/ssl/abc.cn.pem;
ssl_certificate_key /etc/nginx/ssl/abc.cn.pem; index index.php index.html; location / {
try_files $uri $uri/ /index.php?$query_string;
} location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; } access_log /var/log/nginx/abc-access.log;
error_log /var/log/nginx/abc-error.log debug; location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include fastcgi_params;
} location ~ /\.ht {
deny all;
}
}
Nginx配置ThinkPHP和Laravel虚拟主机的更多相关文章
- nginx笔记 安装nginx 配置 反向代理 多虚拟主机
1,检测linux上是否 通过yum安装了nginxrpm -qi nginx 2.安装nginx之前的依赖包yum install gcc patch libffi-devel python- ...
- nginx配置基于域名的虚拟主机
其实基于域名和基于ip的虚拟主机配置是差不多的,在配置基于ip的虚拟主机上我们只需要修改几个地方就能变成基于域名的虚拟主机,一个是要修改域名,一个是host文件直接看代码 [root@localhos ...
- nginx配置实战1----配置虚拟主机
1 nginx虚拟主机的概念 虚拟主机是在网络服务器上划分出一定的磁盘空间供用户放置站点.应用组件等,提供必要的站点功能.数据存放和传输功能,所谓虚拟主机,也叫"网站空间",就是把 ...
- Nginx配置基于ip的虚拟主机
我是在centos7虚拟机上进行实验的 该实验基于添加好ip的基础上,如何给网卡添加ip请查阅我的博客 先来看一下我的ip [root@localhost nginx]# ifconfig ens33 ...
- 【nginx运维基础(2)】Nginx的配置文件说明及虚拟主机配置示例
配置文件说明 #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为当前主机的CPU总核心数. worker_processes 8; #全局错误日志定义类型, ...
- Nginx 反向代理 负载均衡 虚拟主机配置
Nginx 反向代理 负载均衡 虚拟主机配置 通过本章你将学会利用Nginx配置多台虚拟主机,清楚代理服务器的作用,区分正向代理和反向代理的区别,搭建使用Nginx反向搭理和负载均衡,了解Nginx常 ...
- 【转】Nginx 反向代理 负载均衡 虚拟主机配置
原文:http://www.cnblogs.com/itdragon/p/8059000.html Nginx 反向代理 负载均衡 虚拟主机配置 通过本章你将学会利用Nginx配置多台虚拟主机,清楚代 ...
- Nginx(http协议代理 搭建虚拟主机 服务的反向代理 在反向代理中配置集群的负载均衡)
Nginx 简介 Nginx (engine x) 是一个高性能的 HTTP 和反向代理服务.Nginx 是由伊戈尔·赛索耶夫为俄罗斯访问量第二的 Rambler.ru 站点(俄文:Рамблер)开 ...
- Nginx 反向代理 负载均衡 虚拟主机
Nginx 反向代理 负载均衡 虚拟主机配置 通过本章你将学会利用Nginx配置多台虚拟主机,清楚代理服务器的作用,区分正向代理和反向代理的区别,搭建使用Nginx反向搭理和负载均衡,了解Nginx常 ...
随机推荐
- springcloud(一) 服务拆分
一般我们的项目如果需要从单应用服务升级到微服务,必须要将原来的服务做拆分,我这边的拆分也是基于将之前spb-demo的springboot单应用做拆分,拆分出三个应用,spb-brian-query- ...
- linux添加开机启动脚本
[root@mysql ~]# ll /etc/rc.local lrwxrwxrwx. 1 root root 13 Mar 12 22:20 /etc/rc.local -> rc.d/rc ...
- Python while 1 和 while True 速度比较
References http://legacy.python.org/dev/peps/pep-0285/http://stackoverflow.com/questions/3815359/whi ...
- python之处理json
import json# json串就是字符串dic={ 'car':{'color':'red','price':100,'count':50}, 'iphone':{'color':'骚粉色',' ...
- Secrets CodeForces - 333A
Secrets CodeForces - 333A 题意:这个世界上只有这样面值的硬币:1,3,9,27,81,...有一个商人,某一天遇到了一个顾客,他购买了价值n的商品,发现用自己的硬币无法付给商 ...
- Codeforces Round #295 (Div. 2) B. Two Buttons
B. Two Buttons time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...
- POJ 3522 Slim Span 暴力枚举 + 并查集
http://poj.org/problem?id=3522 一开始做这个题的时候,以为复杂度最多是O(m)左右,然后一直不会.最后居然用了一个近似O(m^2)的62ms过了. 一开始想到排序,然后扫 ...
- 机器学习概念之特征处理(Feature processing)
不多说,直接上干货! 肯定也有不少博友,跟我一样,刚开始接触的时候,会对这三个概念混淆. 以下是,特征处理.特征提取.特征转换和特征选择的区别! 特征处理主要包含三个方面:特征提取.特征转换和特征选择 ...
- 在windows下编译出linux可执行程序
set GOARCH=amd64 set GOOS=linux go build xx.go 会生成一个没有后缀的xx二进制文件 将该文件放入linux系统某个文件夹下 赋予权限 chmod 777 ...
- 多线程wait和notify实现1212
package threadT; public class ThreadMain { public static void main(String args[]) { final Object obj ...