lnmp如何部署laravel项目

  1. 对nginx.conf进行配置:vim /usr/local/nginx/conf/nginx.conf
  2. .增加 配置如下:server_name修改成自己的ip或者域名
server {
        listen  8000;  
        server_name ip;
        set $root_path '/path/project_name/public';
        root $root_path;
        index index.php index.html index.htm;
        try_files $uri $uri/ @rewrite;
        location @rewrite {
        rewrite ^/(.*)$ /index.php?_url=/$1;
      }
      location ~ \.php {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index /index.php;
        fastcgi_split_path_info       ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include                       fastcgi_params;
      }
      location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
      root $root_path;
     }
     location ~ /\.ht {
      deny all;
     }
}
  1. 修改权限 ,进入到项目目录下分别输入(www-data为nginx用户):
chown -R www-data storage
chown -R www-data vender

4.重启nginx

/usr/local/nginx/sbin/nginx -s reload

你可能感兴趣的:(laravel)