线上部署


Nginx

nginx配置虚拟机主机

www.comblog.com.conf

  1. server {
  2. listen 80;
  3. server_name www.comblog.com;
  4. charset utf-8;
  5. access_log /data/log/nginx/comblog.access.log;
  6. error_log /data/log/nginx/comblog.error.log;
  7. root /data/comBlog/www/web;
  8. error_page 404 /error/_404?sendResponseCode=0;
  9. location /favicon.ico {
  10. log_not_found off;
  11. access_log off;
  12. }
  13. location / {
  14. index index.php index.html index.htm;
  15. if (!-e $request_filename) {
  16. rewrite ^/(.*)$ /index.php/$1 last;
  17. }
  18. }
  19. location ~ \.php(/|$) {
  20. fastcgi_split_path_info ^(.+?\.php)(/.*)$;
  21. if (!-f $document_root$fastcgi_script_name) {
  22. return 404;
  23. }
  24. fastcgi_pass unix:/dev/shm/php-fpm.sock;
  25. fastcgi_index index.php;
  26. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  27. fastcgi_param PATH_INFO $fastcgi_path_info;
  28. include fastcgi_params;
  29. }
  30. location ~ /\.ht {
  31. deny all;
  32. }
  33. }

Apache

.htaccess文件

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