内容简介:Nginx多站点/域名配置
假设有两个域名,joker.moe和blog.joker.moe,要为每个域名建立一个站点http://joker.moe访问/www目录,http://blog.joker.moe访问/www/bolog目录。
在nginx.conf同目录下新建文件夹vhosts,在nginx.conf里添加 include vhosts/*.conf;
,如:
worker_processes auto;
events {
use epoll;
......
}
http
{
include mime.types;
default_type application/octet-stream;
......
server
{
listen 80 default_server;
#listen [::]:80 default_server ipv6only=on;
server_name _;
index index.html index.htm index.php;
root /www;
location ~ .*\.php(\/.*)*$ {
root /www;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
......
}
include vhosts/*.conf;
}
在vhosts目录里新建blog.joker.moe.conf,当然可以随便命名,后缀是 .conf
就可以了。一下为参考内容
server
{
listen 80;
#listen [::]:80;
server_name blog.joker.moe ;
index index.html index.htm index.php default.html default.htm default.php;
root /www/blog.joker.moe;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
location ~ .*\.php(\/.*)*$ {
root /www/blog.joker.moe;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
......
}
最后重启nginx即可。
标签:nginx
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- 七牛云配置HTTPS站点小记
- Django 配置多站点多域名
- 如何使用 Apache Web 服务器配置多个站点
- 生成根证书CA及签发子证书及配置站点实践
- 创建自签名 SSL 数字证书以配置开发测试环境站点 HTTPS 访问
- [站点记录] 在站点上启用 Let's Encrypt 通配符证书
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
JSP网站开发典型模块与实例精讲
李振捷 / 电子工业出版社 / 2006-8 / 50.0
本书是典型模块与实例精讲丛书中的一本。 本书讲解了使用JSP开发网站系统的经典模块和工程实例,基本囊括了JSP的重点技术,对这些模块稍加修改就可以直接使用到实际项目中。为了方便本书的读者交流在学习中遇到的问题,特地在本书的服务网站上公布了很多QQ群组,读者只要拥有QQ号码,就可以参与到本书的QQ学习群组中一起讨论学习心得。本书的作者还在一定的时间给读者提供在线答疑服务。一起来看看 《JSP网站开发典型模块与实例精讲》 这本书的介绍吧!