/etc/nginx/sites-available/xxxx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | server { listen 80; server_name laravel.wuboy.twbbs.org; root /usr/home/git/laravel/public; access_log /var/log/nginx/laravel_access.log; error_log /var/log/nginx/laravel_error.log; location / { index index.php index.html index.htm; } if ($request_uri ~* index/?$) { rewrite ^/(.*)/index/?$ /$1 permanent; } # removes trailing slashes (prevents SEO duplicate content issues) if (!-d $request_filename) { rewrite ^/(.+)/$ /$1 permanent; } # removes access to "system" folder, also allows a "System.php" controller if ($request_uri ~* ^/system) { rewrite ^/(.*)$ /index.php?/$1 last; break; } # unless the request is for a valid file (image, js, css, etc.), send to bootstrap if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?/$1 last; break; } # catch all error_page 404 /index.php; # use fastcgi for all php files location ~ \.php$ { fastcgi_pass unix:/tmp/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /usr/local/etc/nginx/fastcgi_params; fastcgi_param HTTPS off; } # deny access to apache .htaccess files location ~ /\.ht { deny all; } } |
參考資料:
https://blog.wu-boy.com/2012/10/php-mvc-framework-nginx-php-fpm/ PHP MVC Framework 搭配 Nginx + PHP-FPM 設定檔
沒有留言:
張貼留言