zoukankan      html  css  js  c++  java
  • 配置laravel的nginx站点

    server{}配置
    server{
            #端口配置
            listen 80;
            #域名配置
            server_name laravel.cc;
    
            index index.php index.html index.htm;
            #站点配置到public
            root /data/wwwroot/laravel.cc/public;
          #日志记录
            access_log /data/logs/nginx.laravel.cc.log access;
            error_log /data/logs/nginx.laravel.cc.error debug;
         #静态文件配置
            location ~ .*.(jpg|jpeg|gif|png|bmp|css|js|swf|txt|ttf|woff|ico)$ {
                    expires 7d;
                    break;
            }
    
            location / {
             #重点区
                    try_files $uri $uri/ /index.php?$query_string;
                    index index.php index.html index.htm;
            }
            #静态文件配置
            location /logs {
                    autoindex on;
                    autoindex_exact_size off;
                    autoindex_localtime on;
                    break;
            }
            #处理php配置
            location ~ ".php$" {
                    include fastcgi_params;
                    fastcgi_index index.php;
                    #在nginx.conf配置server_mango
                    fastcgi_pass server_mango;
            }
    }
    

      

    http下的server_mango配置

      

    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"';
    
        log_format access '$remote_addr [$time_local] "$http_host" "$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;
        server_tokens       off;
    
        #keepalive_timeout  0;
        keepalive_timeout  65;
    
        gzip on;
        gzip_min_length  5k;
        gzip_buffers     4 16k;
        #gzip_http_version 1.0;
        gzip_comp_level 3;
        gzip_types       text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
        gzip_vary on;
        #重点区与server{}中的处理php应用到的
        upstream server_mango {
            server 127.0.0.1:9000;
        }
        #加载vhost下的.conf后缀所有文件
        include /usr/local/nginx/conf/vhost/*.conf;
    }
    

      

  • 相关阅读:
    LeetCode偶尔一题 —— 617. 合并二叉树
    《剑指offer》 —— 链表中倒数第k个节点
    《剑指offer》 —— 青蛙跳台阶问题
    《剑指offer》—— 二维数组中的查找
    《剑指offer》—— 替换空格
    《剑指offer》—— 合并两个排序的链表
    《剑指offer》—— 礼物的最大价值
    生成Nuget 源代码包来重用你的Asp.net MVC代码
    Pro ASP.Net Core MVC 6th 第四章
    Pro ASP.NET Core MVC 6th 第三章
  • 原文地址:https://www.cnblogs.com/300js/p/7655990.html
Copyright © 2011-2022 走看看