我有一个水疗项目,前端和后端都在不同的港口运行。
我使用laravel来构建后端,在项目完成后,我运行通讯开始。
php artisan serve --port=3001 而nginx是这样的:
# backend
server {
listen 3000 default_server;
listen [::]:3000 default_server;
root /usr/nextJs/nextTestBackend/public;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
proxy_pass http://localhost:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}在那之后,127.0.0.1:3000/api/GET/users将变成127.0.0.1:3001/api/GET/users,然后访问我的laravel后端。
这是使用nginx部署后端的一种很好的方法吗?还是有其他方法可以做到?
我不知道使用 production是否可以在生产中使用?
发布于 2018-10-11 07:35:01
这是使用nginx部署后端的一种很好的方法吗?是的,nginx是个不错的选择,这是u https://www.digitalocean.com/community/tutorials/how-to-deploy-a-laravel-application-with-nginx-on-ubuntu-16-04的好导师,还是有其他方法可以做到?你可以使用apache
https://stackoverflow.com/questions/52754008
复制相似问题