nginx配置多个站点的问题?
我用nginx配置两个站点,一个站点要配置成https访问,一个是http来访问?
server {
<code> listen 443; server_name www.gzjjhd.com; ssl on; ssl_certificate E:/webserver/nginx/sslkey/wosign.com.crt; ssl_certificate_key E:/webserver/nginx/sslkey/wosign.com.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL; ssl_prefer_server_ciphers on; location / { root E:/www/jsd; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { root E:/www/jsd; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } server { listen 80; server_name app.gzjjhd.com; location / { root E:/www/HDWeb; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } include E:/www/HDWeb/rewrite.conf; location ~ \.php$ { root E:/www/HDWeb; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } </code>
我这样配置完,app.gzjjhd.com 也变成 https://appgzjjhd.com 来访问。但是我不想要这样。我要http://app.gzjjhd.com 请教各位大神如何修改!
回复内容:
我用nginx配置两个站点,一个站点要配置成https访问,一个是http来访问?
server {
<code> listen 443; server_name www.gzjjhd.com; ssl on; ssl_certificate E:/webserver/nginx/sslkey/wosign.com.crt; ssl_certificate_key E:/webserver/nginx/sslkey/wosign.com.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL; ssl_prefer_server_ciphers on; location / { root E:/www/jsd; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { root E:/www/jsd; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } server { listen 80; server_name app.gzjjhd.com; location / { root E:/www/HDWeb; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } include E:/www/HDWeb/rewrite.conf; location ~ \.php$ { root E:/www/HDWeb; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } </code>
我这样配置完,app.gzjjhd.com 也变成 https://appgzjjhd.com 来访问。但是我不想要这样。我要http://app.gzjjhd.com 请教各位大神如何修改!
分别用两个站点配置文件
原来是我的443端口被占用了
配置多个站点, 也就是虚拟主机的意思, 同一个server,加载多个站点, 在ngixn中配置虚拟主机,直接在主配置文件添加一个server{} 就可以了, 仿照他自带的sever里面的参数
<code>78 server { 79 listen 80; 80 # listen somename:8080; 81 server_name www.xuping.com; 82 root /usr/share/nginx/xuping; 83 index index.html index.htm; 84 85 location / { 86 try_files $uri $uri/ =404; 87 } 88 location ~ \.php$ { 89 fastcgi_split_path_info ^(.+\.php)(/.+)$; 90 # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini 91 92 # With php5-cgi alone: 93 # fastcgi_pass 127.0.0.1:9000; 94 # # With php5-fpm: 95 fastcgi_pass unix:/var/run/php5-fpm.sock; 96 fastcgi_index index.php; 97 include fastcgi_params; 98 } 99 </code>
100 # deny access to .htaccess files, if Apache's document root
101 # concurs with nginx's one
102 #
103 location ~ /.ht {
104 deny all;
105 }
106 }
直接在这里制定端口号和规则就可以了。

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

PHP 8.4 带来了多项新功能、安全性改进和性能改进,同时弃用和删除了大量功能。 本指南介绍了如何在 Ubuntu、Debian 或其衍生版本上安装 PHP 8.4 或升级到 PHP 8.4

CakePHP 是 PHP 的开源框架。它的目的是使应用程序的开发、部署和维护变得更加容易。 CakePHP 基于类似 MVC 的架构,功能强大且易于掌握。模型、视图和控制器 gu

Visual Studio Code,也称为 VS Code,是一个免费的源代码编辑器 - 或集成开发环境 (IDE) - 可用于所有主要操作系统。 VS Code 拥有针对多种编程语言的大量扩展,可以轻松编写

CakePHP 是一个开源MVC 框架。它使开发、部署和维护应用程序变得更加容易。 CakePHP 有许多库可以减少大多数常见任务的过载。

登录 CakePHP 是一项非常简单的任务。您只需使用一项功能即可。您可以记录任何后台进程(如 cronjob)的错误、异常、用户活动、用户采取的操作。在 CakePHP 中记录数据很容易。提供了 log() 函数
