Nginx configuration for Laravel in a different port on CentOS 7
I have a DigitalOcean droplet for testing purposes and I usually deploy static websites, Node.js APIs, and Laravel projects. So in order to get Laravel and the Node.js servers working in the same droplet, I need to set a different port for each one using Nginx and FirewallD to open the needed port.
The following Nginx server block works with any Laravel version and it’s been used under CentOS 6.x and 7.x
- Create a new .conf file.
- Paste the above server block code and save it with
Ctrl + X
- Reload and restart the Nginx server.
service nginx reload && service nginx restart