nginx.conf中配置laravel框架站点

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx.conf中配置laravel框架站点相关的知识,希望对你有一定的参考价值。

nginx.conf配置如下:

user nginx nginx;
worker_processes 4;

error_log logs/error.log error;

pid logs/nginx.pid;
worker_rlimit_nofile 102400;

events {
use epoll;
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

log_format gzip ‘$remote_addr - $remote_user [$time_local] ‘
‘"$request" $status $bytes_sent ‘
‘"$http_referer" "$http_user_agent" "$gzip_ratio"‘;
access_log /spool/logs/nginx-access.log gzip buffer=32k;
#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
#keepalive_timeout 65;

tcp_nopush on;
tcp_nodelay on;


fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 256k;
fastcgi_buffers 16 256k;
fastcgi_busy_buffers_size 512k;
fastcgi_temp_file_write_size 512k;
server_names_hash_bucket_size 128;
## Start: Size Limits & Buffer Overflows ##
client_body_buffer_size 1K;
client_header_buffer_size 1k;
client_max_body_size 2m;
large_client_header_buffers 4 2m;
## END: Size Limits & Buffer Overflows ##
## Start: Timeouts ##
client_body_timeout 10;
client_header_timeout 10;
keepalive_timeout 5 5;
send_timeout 10;
## End: Timeouts ##
gzip on;
gzip_min_length 1k;
gzip_buffers 8 32k;
gzip_http_version 1.1;
gzip_comp_level 3;
gzip_types text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/json application/atom+xml;
gzip_vary on;


server {
listen 80;
server_name beta.linda.funshion.com;
access_log logs/linda.access.log gzip buffer=32k;
error_log logs/linda.error.log;
set $root_path ‘/var/www/linda040/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 unix:/tmp/php-fpm.socket;
#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;
}
}

}

以上是关于nginx.conf中配置laravel框架站点的主要内容,如果未能解决你的问题,请参考以下文章

nginx虚拟主机配置

nginx多站点配置

如何在服务器中找到站点的所有配置

通过Nginx部署flask项目和静态站点

linux上nginx新建站点

百度云BCH虚拟服务器的laravel框架配置