zoukankan      html  css  js  c++  java
  • thinkphp ,laravel,yii2运行环境搭建.

    Nginx 

    YII

    server {    
        charset utf-8;    
        client_max_body_size 128M;    
        listen 80;    
        server_name 2bphp.com;    
        root  /data/www/yii2/web;    
        index  index.php;    
        
        location ~* .(eot|otf|ttf|woff)$ {    
            add_header Access-Control-Allow-Origin *;    
        }    
        
        location / {    
            try_files $uri $uri/ /index.php?$args;    
        }   
         
        location ~ .php$ {    
            include   fastcgi_params;
            fastcgi_index    index.php;
            fastcgi_param    SCRIPT_FILENAME    $document_root$fastcgi_script_name;    
            fastcgi_pass   127.0.0.1:9000;    
            try_files $uri =404;    
        }    
    }
    server {    
        charset utf-8;    
        client_max_body_size 128M;    
        listen 80;    
        server_name laravel.local.test;    
        root  /data/www/laravel/public;    
        index  index.php;    
        
        location ~* .(eot|otf|ttf|woff)$ {    
            add_header Access-Control-Allow-Origin *;    
        }    
        
        location / {    
            try_files $uri $uri/ /index.php?$args;    
        }   
         
        location ~ .php$ {    
            include   fastcgi_params;
            fastcgi_index    index.php;
            fastcgi_param    SCRIPT_FILENAME    $document_root$fastcgi_script_name;    
            fastcgi_pass   127.0.0.1:9000;    
            try_files $uri =404;    
        }    
    }
    

      

    server {    
        charset utf-8;    
        client_max_body_size 128M;    
        listen 80;    
        server_name tp5.local.test;    
        root  /data/www/tp5/public;    
        index  index.php;    
        
        location ~* .(eot|otf|ttf|woff)$ {    
            add_header Access-Control-Allow-Origin *;    
        }    
        
        location / {    
            index    index.html index.php;    
            if ( -f $request_filename) {    
                break;    
            } 
           
            if ( !-e $request_filename) {    
                rewrite ^/(.*)$ /index.php/$1 last;    
                break;    
            }    
        }    
        
        location ~ .php {    
            set $script $uri;    
            set $path_info "";    
            if ($uri ~ "^(.+.php)(/.+)") {    
                set $script $1;    
                set $path_info $2;    
            }    
        include   fastcgi_params;    
        fastcgi_index    index.php?IF_REWRITE=1;    
        fastcgi_pass   127.0.0.1:9000;    
        fastcgi_param    PATH_INFO    $path_info;    
        fastcgi_param    SCRIPT_FILENAME    $document_root$fastcgi_script_name;    
        fastcgi_param    SCRIPT_NAME    $script;    
        try_files $uri =404;    
        }    
    }

    Apache 

    <VirtualHost *:80>    
           ServerName yii.local.test    
           DocumentRoot /data/www/yii2/web    
           <Directory "/data/www/yii2/web">    
                RewriteEngine on    
                   RewriteCond %{REQUEST_FILENAME} !-f    
                   RewriteCond %{REQUEST_FILENAME} !-d    
                   RewriteRule . index.php    
           </Directory>       
    </VirtualHost>

    .htaccess 代码如下

    RewriteEngine on    
    # If a directory or a file exists, use it directly    
    RewriteCond %{REQUEST_FILENAME} !-f    
    RewriteCond %{REQUEST_FILENAME} !-d    
    # Otherwise forward it to index.php    
    RewriteRule . index.php
    

      

    <VirtualHost *:80>    
               ServerName laravel.local.test    
               DocumentRoot /data/www/laravel/public    
               <Directory "/data/www/laravel/public">    
                RewriteEngine on    
                   RewriteCond %{REQUEST_FILENAME} !-f    
                   RewriteCond %{REQUEST_FILENAME} !-d    
                   RewriteRule . index.php    
               </Directory>    
    </VirtualHost>

    .htaccess 代码如下

    <IfModule mod_rewrite.c>    
        <IfModule mod_negotiation.c>    
            Options -MultiViews    
        </IfModule>    
        RewriteEngine On    
        # Redirect Trailing Slashes If Not A Folder...    
        RewriteCond %{REQUEST_FILENAME} !-d    
        RewriteRule ^(.*)/$ /$1 [L,R=301]    
        # Handle Front Controller...    
        RewriteCond %{REQUEST_FILENAME} !-d    
        RewriteCond %{REQUEST_FILENAME} !-f    
        RewriteRule ^ index.php [L]    
    </IfModule>
    

      

    <VirtualHost *:80>    
           ServerName tp5.local.test    
           DocumentRoot /data/www/tp5/public/     
    </VirtualHost>

     .htaccess 代码如下

    <IfModule mod_rewrite.c>    
        Options +FollowSymlinks -Multiviews    
        RewriteEngine On    
        RewriteCond %{REQUEST_FILENAME} !-d    
        RewriteCond %{REQUEST_FILENAME} !-f    
        RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]    
    </IfModule>

     本文来源网站  编程浪子

  • 相关阅读:
    用c#小程序理解线程
    我对线程入门理解
    网站发布后IIS故障解决办法
    ASP .NET XML 文件
    SortedList 对象兼有 ArrayList 和 Hashtable 对象的特性。
    (笔记)索引器
    HOW TO:使用 Visual C# .NET 在 ASP.NET 中创建自定义错误报告
    读取EXCEL的数据到datagridview
    一个超级简单的文件流操作WINDOW应用程序
    Gridview事件
  • 原文地址:https://www.cnblogs.com/aln0825/p/8998565.html
Copyright © 2011-2022 走看看