浏览代码

koel nginx configuration

Bob Mottram 8 年前
父节点
当前提交
324d058a28
共有 1 个文件被更改,包括 31 次插入25 次删除
  1. 31
    25
      src/freedombone-app-koel

+ 31
- 25
src/freedombone-app-koel 查看文件

369
         echo '  gzip_comp_level 9;' >> $koel_nginx_site
369
         echo '  gzip_comp_level 9;' >> $koel_nginx_site
370
         echo '' >> $koel_nginx_site
370
         echo '' >> $koel_nginx_site
371
         echo '  # Security' >> $koel_nginx_site
371
         echo '  # Security' >> $koel_nginx_site
372
-        function_check nginx_ssl
372
+        function_check nginx_ssl mobile
373
         nginx_ssl $KOEL_DOMAIN_NAME
373
         nginx_ssl $KOEL_DOMAIN_NAME
374
 
374
 
375
         function_check nginx_disable_sniffing
375
         function_check nginx_disable_sniffing
400
         echo '' >> $koel_nginx_site
400
         echo '' >> $koel_nginx_site
401
         echo '  }' >> $koel_nginx_site
401
         echo '  }' >> $koel_nginx_site
402
         echo '' >> $koel_nginx_site
402
         echo '' >> $koel_nginx_site
403
+        echo '  # PHP' >> $koel_nginx_site
404
+        echo '  location ~ \.php {' >> $koel_nginx_site
405
+        echo '    include snippets/fastcgi-php.conf;' >> $koel_nginx_site
406
+        echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $koel_nginx_site
407
+        echo '  }' >> $koel_nginx_site
408
+        echo '' >> $koel_nginx_site
409
+        echo '  # Location' >> $koel_nginx_site
403
         echo '  location / {' >> $koel_nginx_site
410
         echo '  location / {' >> $koel_nginx_site
404
         function_check nginx_limits
411
         function_check nginx_limits
405
         nginx_limits $KOEL_DOMAIN_NAME '15m'
412
         nginx_limits $KOEL_DOMAIN_NAME '15m'
406
-        echo '    try_files   $uri $uri/ /index.php?$args;' >> $koel_nginx_site
413
+        echo '    try_files $uri $uri/ @koel;' >> $koel_nginx_site
407
         echo '  }' >> $koel_nginx_site
414
         echo '  }' >> $koel_nginx_site
408
         echo '' >> $koel_nginx_site
415
         echo '' >> $koel_nginx_site
409
-        echo '  location ~ \.php$ {' >> $koel_nginx_site
410
-        echo '    try_files $uri $uri/ /index.php?$args;' >> $koel_nginx_site
411
-        echo '' >> $koel_nginx_site
412
-        echo '    fastcgi_param     PATH_INFO $fastcgi_path_info;' >> $koel_nginx_site
413
-        echo '    fastcgi_param     PATH_TRANSLATED $document_root$fastcgi_path_info;' >> $koel_nginx_site
414
-        echo '    fastcgi_param     SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> $koel_nginx_site
416
+        echo '  # Fancy URLs' >> $koel_nginx_site
417
+        echo '  location @koel {' >> $koel_nginx_site
418
+        echo '    rewrite ^(.*)$ /index.php?p=$1 last;' >> $koel_nginx_site
419
+        echo '  }' >> $koel_nginx_site
415
         echo '' >> $koel_nginx_site
420
         echo '' >> $koel_nginx_site
416
-        echo "    fastcgi_pass              127.0.0.1:$KOEL_PORT;" >> $koel_nginx_site
417
-        echo '    fastcgi_index             index.php;' >> $koel_nginx_site
418
-        echo '    fastcgi_split_path_info   ^(.+\.php)(/.+)$;' >> $koel_nginx_site
419
-        echo '    fastcgi_intercept_errors  on;' >> $koel_nginx_site
420
-        echo '    include                   fastcgi_params;' >> $koel_nginx_site
421
+        echo '  # Restrict access that is unnecessary anyway' >> $koel_nginx_site
422
+        echo '  location ~ /\.(ht|git) {' >> $koel_nginx_site
423
+        echo '    deny all;' >> $koel_nginx_site
421
         echo '  }' >> $koel_nginx_site
424
         echo '  }' >> $koel_nginx_site
422
         echo '' >> $koel_nginx_site
425
         echo '' >> $koel_nginx_site
423
         echo '}' >> $koel_nginx_site
426
         echo '}' >> $koel_nginx_site
455
     echo '' >> $koel_nginx_site
458
     echo '' >> $koel_nginx_site
456
     echo '  }' >> $koel_nginx_site
459
     echo '  }' >> $koel_nginx_site
457
     echo '' >> $koel_nginx_site
460
     echo '' >> $koel_nginx_site
461
+    echo '  # PHP' >> $koel_nginx_site
462
+    echo '  location ~ \.php {' >> $koel_nginx_site
463
+    echo '    include snippets/fastcgi-php.conf;' >> $koel_nginx_site
464
+    echo '    fastcgi_pass unix:/var/run/php5-fpm.sock;' >> $koel_nginx_site
465
+    echo '  }' >> $koel_nginx_site
466
+    echo '' >> $koel_nginx_site
467
+    echo '  # Location' >> $koel_nginx_site
458
     echo '  location / {' >> $koel_nginx_site
468
     echo '  location / {' >> $koel_nginx_site
459
     function_check nginx_limits
469
     function_check nginx_limits
460
     nginx_limits $KOEL_DOMAIN_NAME '15m'
470
     nginx_limits $KOEL_DOMAIN_NAME '15m'
461
-    echo '    try_files   $uri $uri/ /index.php?$args;' >> $koel_nginx_site
471
+    echo '    try_files $uri $uri/ @koel;' >> $koel_nginx_site
462
     echo '  }' >> $koel_nginx_site
472
     echo '  }' >> $koel_nginx_site
463
     echo '' >> $koel_nginx_site
473
     echo '' >> $koel_nginx_site
464
-    echo '  location ~ \.php$ {' >> $koel_nginx_site
465
-    echo '    try_files $uri $uri/ /index.php?$args;' >> $koel_nginx_site
466
-    echo '' >> $koel_nginx_site
467
-    echo '    fastcgi_param     PATH_INFO $fastcgi_path_info;' >> $koel_nginx_site
468
-    echo '    fastcgi_param     PATH_TRANSLATED $document_root$fastcgi_path_info;' >> $koel_nginx_site
469
-    echo '    fastcgi_param     SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> $koel_nginx_site
474
+    echo '  # Fancy URLs' >> $koel_nginx_site
475
+    echo '  location @koel {' >> $koel_nginx_site
476
+    echo '    rewrite ^(.*)$ /index.php?p=$1 last;' >> $koel_nginx_site
477
+    echo '  }' >> $koel_nginx_site
470
     echo '' >> $koel_nginx_site
478
     echo '' >> $koel_nginx_site
471
-    echo "    fastcgi_pass              127.0.0.1:$KOEL_PORT;" >> $koel_nginx_site
472
-    echo '    fastcgi_index             index.php;' >> $koel_nginx_site
473
-    echo '    fastcgi_split_path_info   ^(.+\.php)(/.+)$;' >> $koel_nginx_site
474
-    echo '    fastcgi_intercept_errors  on;' >> $koel_nginx_site
475
-    echo '    include                   fastcgi_params;' >> $koel_nginx_site
479
+    echo '  # Restrict access that is unnecessary anyway' >> $koel_nginx_site
480
+    echo '  location ~ /\.(ht|git) {' >> $koel_nginx_site
481
+    echo '    deny all;' >> $koel_nginx_site
476
     echo '  }' >> $koel_nginx_site
482
     echo '  }' >> $koel_nginx_site
477
     echo '' >> $koel_nginx_site
483
     echo '' >> $koel_nginx_site
478
     echo '}' >> $koel_nginx_site
484
     echo '}' >> $koel_nginx_site