线上部署


Nginx

nginx配置虚拟机主机

www.comblog.com.conf

server {
    listen       80;
    server_name  www.comblog.com;

    charset utf-8;
    access_log  /data/log/nginx/comblog.access.log;
    error_log   /data/log/nginx/comblog.error.log;

    root    /data/comBlog/public;

    error_page 404 /error/_404?sendResponseCode=0;

    location /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location / {
        index   index.php index.html index.htm;
        if (!-e $request_filename) {
            rewrite ^/(.*)$ /index.php/$1 last;
        }
    }

    location ~ \.php(/|$) {

        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        }
        fastcgi_pass   unix:/dev/shm/php-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO        $fastcgi_path_info;
        include        fastcgi_params;
    }

    location ~ /\.ht {
        deny  all;
    }
}

Apache

.htaccess文件

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>