配置lnmp之Nginx网站支持https加密访问 注: 1. 这里拿购买的(pxsnx.pxjy.com)证书来做样例 证书文件共有三个---> (pxsnxg.pxjy.com_ca.crt    pxsnxg.pxjy.com.cer   pxsnxg.pxjy.com.key) 2. 配置前提,Nginx需要把ssl模块编译进去         3. nginx 进行配置的时候,只需要用到了pxsnxg.pxjy.com.cer    pxsnxg.pxjy.com.key 两个即可 一…
<一.参考> 这里以配置2个站点(2个域名)为例,n 个站点可以相应增加调整,假设: IP地址: 202.55.1.100 域名1 example1.com 放在 /www/example1 域名2 example2.com 放在 /www/example2 配置 nginx virtual hosting 的基本思路和步骤如下: 把2个站点 example1.com, example2.com 放到 nginx 可以访问的目录 /www/ 给每个站点分别创建一个 nginx 配置文件 exa…
Let's Encrypt是很火的一个免费SSL证书发行项目,自动化发行证书,证书有90天的有效期.适合个人使用或者临时使用,不用再忍受自签发证书不受浏览器信赖的提示.Let's Encrypt已经发布了新的工具certbot,虽然是新的工具,但是生成证书的使用方法和参数是基本一致的,证书续期更简单了.但是目前看certbot在一些老版本的Linux发行版上的兼容性还是有问题的,特别是在CentOS 5上因为python版本过低是无法用的,CentOS 6上需要先安装epel才行,当然也有很多第…
一.配置 #vi /usr/local/nginx/conf/vhost/test.com.conf 写入: server { listen 80; server_name test.com test1.com test2.com; //是server_name后面可以跟多个域名 index index.html index.htm index.php; root /data/nginx/test.com; if ($host != 'test.com' ){ rewrite ^(.*)$ ht…
一.配置 #vi /usr/local/nginx/conf/vhost/test.com.conf 写入: server { listen 80; server_name test.com test1.com test2.com; index index.html index.htm index.php; root /data/nginx/test.com; if ($host != 'test.com' ){ rewrite ^(.*)$ http://test.com/$1 permane…
一.配置 首先修改配置文件 #vi /usr/local/nginx/conf/nginx.conf 在最后一个结束符号}前加一行配置: include vhost/*.conf; 意思就是/usr/local/nginx/conf/host下面的所有以.conf结尾的文件都会被加载 #mkdir /usr/local/nginx/conf/vhost #cd /usr/local/nginx/conf/vhost #vim default.conf 写入 server { listen 80…
1.先做域名映射,由于我们使用的是阿里云域名. 登录阿里云控制台-->域名与网站(万网)-->域名-->选择一个域名-->域名解析-->添加记录 配置静态资源下载转发: server { listen 80; server_name 192.168.0.251; location ~* (.*.xlsx) { #以访问xlsx结尾的文件转发到192.168.0.252 proxy_pass http://192.168.0.252; } } 2.在服务器nginx的配置文件夹…
我是通过homebrew 安装nginx 的,所以安装目录是默认的,之前多个server都是放在默认安装目录下的nginx.conf里的,但是这样不太好,就是会导致nginx.conf 越来越长,而且容易出现一些大括号缺失啥的类似的语法错误.看了下老大配的虚拟目录感觉不错,自己弄了下,成功了.好处是每个server 站点相互独立,互不影响,很简单,分享下过程~ 1.首先在nginx 的配置目录下:/usr/local/etc/nginx 新建一个文件夹sites,然后可以创建一个或多个配置文件例…
一.配置 #vi /usr/local/nginx/conf/vhost/test.com.conf 写入: server { listen 80; server_name test.com test1.com test2.com; index index.html index.htm index.php; root /data/nginx/test.com; if ($host != 'test.com' ) { rewrite ^/(.*)$ http://test.com/$1 perma…
一.配置 #vi /usr/local/nginx/conf/vhost/test.com.conf 写入; server { listen 80; server_name test.com test1.com test2.com; index index.html index.htm index.php; root /data/nginx/test.com; if ($host != 'test.com' ){ rewrite ^(.*)$ http://test.com/$1 permane…