使用nginx部署Yii 2.0\yii-advanced-app-2.0.6

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘
    #                  ‘$status $body_bytes_sent "$http_referer" ‘
    #                  ‘"$http_user_agent" "$http_x_forwarded_for"‘;

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    client_max_body_size 8M;
    client_body_buffer_size 128k;

    server {
        listen       80;
        server_name  frontend.dev;

        charset utf-8;

        #access_log  logs/host.access.log  main;

        root   E:/xampp/htdocs/html5/php/yii-advanced-app-2.0.6/advanced/frontend/web;
        index  index.php;

        location / {
        try_files $uri $uri /index.php?$args;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        try_files $uri =404;
        }

        # deny access to .htaccess files, if Apache‘s document root
        # concurs with nginx‘s one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

    server {
        listen       80;
        server_name  backend.dev;

        charset utf-8;

        #access_log  logs/host.access.log  main;

        root   E:/xampp/htdocs/html5/php/yii-advanced-app-2.0.6/advanced/backend/web;
        index  index.php;

        location / {
        try_files $uri $uri /index.php?$args;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        try_files $uri =404;
        }

        # deny access to .htaccess files, if Apache‘s document root
        # concurs with nginx‘s one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}
时间: 2024-08-02 02:44:59

使用nginx部署Yii 2.0\yii-advanced-app-2.0.6的相关文章

基于Centos7.2的nginx部署

基于Centos7.2的nginx部署 部署背景:使用Nginx作为Tomcat的负载平衡器. 部署步骤: 安装zlib-devel.pcre-devel等依赖包 [[email protected] ~]#  yum install -y gcc gcc-c++ make libtool zlib zlib-devel pcre pcre-devel openssl openssl-devel 注:结合proxy和upstream模块实现后端web负载均衡 结合nginx默认自带的ngx_ht

nginx 部署

nginx服务器部署 Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行.Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本0.1.0发布于2004年10月4日.其将源代码以类BSD许可证的形式发布,因它的稳定性.丰富的功能集.示例配置文件和低系统资源的消耗而闻名. 部署环境: 环境系统:red hat 5 内核版本:2.6.18-371.el5 ng

Django+uWSGI+Nginx 部署网站

Django 1.11设置 保证Django在本地调试没有问题: 当然这是前提^_^ 收集静态文件至指定文件夹 Django静态文件设置具体参考:https://docs.djangoproject.com/en/1.11/ref/contrib/staticfiles/ 在myproject/settings.py中设置静态文件STATIC_URL和STATIC_ROOT设置: 如: STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE

使用nginx部署网站

前面的话 如果服务器只需要放置一个网站程序,解析网站到服务器的网站,网站程序监听80端口就可以了.如果服务器有很多应用,借助nginx不仅可以实现端口的代理,还可以实现负载均衡.本文将详细介绍前端及nodeJS项目在服务器配置时需要用到的nginx配置 安装 [卸载nginx] 在介绍如何安装nginx之前,先要介绍如何卸载nginx.因为nginx不正确的安装,导致无法正常运行,所以需要卸载nginx sudo apt-get remove nginx nginx-common # 卸载删除除

django+uwsgi+nginx部署(非常详细)

django+uwsgi+nginx部署 1.介绍: 在网上看了很多教程,但自己部署了很久都没有成功,这篇博文记录自己所踩过得坑. 2.环境: 1 Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-130-generic x86_64) 3.下载uwsgi以及nginx 1 apt-get install uwsgi 2 apt-get install nginx (注:如果下载异常出现权限问题,在命令前添加sudo) 4.创建Django项目 例如:项目名为mysite

【Nginx】Nginx部署Windows设置80端口

Nginx部署在Windows端口做负载均衡时,配置其监听80端口.Start时会发现无法启动,原因为其80端口已被占用. 即使IIS中关闭全部80端口的网站后访问此80端口出现的是404,而非网络断开连接.可以推断出IIS或相关容器一直监听 导致Nginx无法启动的.通过CMD->netstat -ano | findstr "80"发现PID为4的System进程占用. 目前找到的解决方案是修改注册表,重启服务器可以解决此问题:\HKEY_LOCAL_MACHINE\SYST

Nginx 部署 Ant Design pro

利用Ant Design pro开发的项目,如何用Nginx部署呢? 第一步:把项目打包,打包命令如下: npm run build 运行完毕会在项目目录下生成dist文件夹. 第二步:想要测试打包好的代码是否可以正常运行,安装serve,如下命令 npm i serve -g serve安装完毕,利用serve运行打包好的代码,运行命令: serve dist 测试完毕,代码可以正常运行. 第三步:用Nginx进行部署. 1.下载Nginx:http://nginx.org/en/downlo

vue+uwsgi+nginx部署前后端分离项目

一:vue+uwsgi+nginx部署 1.1:准备代码: # 路飞学城django代码 https://files.cnblogs.com/files/pyyu/luffy_boy.zip # vue代码 https://files.cnblogs.com/files/pyyu/07-luffy_project_01.zip 1.2:部署准备 1. 部署环境准备 ⑴ . 准备python3和虚拟环境解释器,python3,virtualenvwrapper. pip3 install -i h

Nginx部署多个站点

Nginx部署多个站点 一,介绍与需求 1.1,介绍 详细介绍请看nginx代理部署Vue与React项目,在这儿主要介绍多个站点的配置 1.2,需求 有时候想在一台服务器上为不同的域名/不同的二级域名运行不同的站点.比如www.webA.com作为官网前台,www.webB.com/admin.webA.com作为后台管理系统.可以把你的服务器IP分别解析到两个域名上,然后反向代理不同的站点,站点的服务名必须与域名对应. 二,Nginx配置 第一步:新建webServer文件夹 1 mkdir