0
我试图调节两个Laravel应用程序...有一个主要的应用程序和API,必须路径Laravel 4下Nginx的代理反向
主要应用URI下运行:http://subdomain.domain.com API应用URI: http://subdomain.domain.com/api/
所以,在这里Nginx的配置:
server {
listen 80;
server_name subdomain.domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443;
server_name subdomain.domain.com;
ssl on;
ssl_certificate ...;
ssl_certificate_key ...;
root /usr/share/nginx/html/main_project/current/public;
index index.php index.html index.htm;
location/{
try_files $uri $uri/ /index.php$is_args$args;
}
location /api {
proxy_pass http://127.0.0.1:81;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Cache-Control public;
}
# pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_ADMIN_VALUE "open_basedir=none";
fastcgi_param HTTPS on;
}
}
server {
listen 81;
root /usr/share/nginx/html/api_project/current/public;
index index.php index.html index.htm;
location/{
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
的问题是:在API的应用程序的路由无法正常工作。任何人都可以帮助我?