Created
September 24, 2024 20:01
-
-
Save marklj/6eef2cc4adac587ad380fffbc195b885 to your computer and use it in GitHub Desktop.
Laravel Herd Nginx API UI Proxy Configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 127.0.0.1:80; | |
| server_name domain.test; | |
| root /; | |
| location ^~ /api { | |
| rewrite ^ "/Applications/Herd.app/Contents/Resources/valet/server.php" last; | |
| } | |
| location / { | |
| proxy_pass http://localhost:3000/ ; | |
| } | |
| location = /favicon.ico { access_log off; log_not_found off; } | |
| location = /robots.txt { access_log off; log_not_found off; } | |
| access_log off; | |
| error_log "/Users/USERNAME/Library/Application Support/Herd/Log/nginx-error.log"; | |
| error_page 404 "/Applications/Herd.app/Contents/Resources/valet/server.php"; | |
| location ~ [^/api]\.php(/|$) { | |
| fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
| fastcgi_pass $herd_sock; | |
| fastcgi_index "/Applications/Herd.app/Contents/Resources/valet/server.php"; | |
| fastcgi_param QUERY_STRING $query_string; | |
| fastcgi_param REQUEST_METHOD $request_method; | |
| fastcgi_param CONTENT_TYPE $content_type; | |
| fastcgi_param CONTENT_LENGTH $content_length; | |
| fastcgi_param SCRIPT_FILENAME $request_filename; | |
| fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
| fastcgi_param REQUEST_URI $request_uri; | |
| fastcgi_param DOCUMENT_URI $document_uri; | |
| fastcgi_param DOCUMENT_ROOT $document_root; | |
| fastcgi_param SERVER_PROTOCOL $server_protocol; | |
| fastcgi_param GATEWAY_INTERFACE CGI/1.1; | |
| fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; | |
| fastcgi_param REMOTE_ADDR $remote_addr; | |
| fastcgi_param REMOTE_PORT $remote_port; | |
| fastcgi_param SERVER_ADDR $server_addr; | |
| fastcgi_param SERVER_PORT $server_port; | |
| fastcgi_param SERVER_NAME $server_name; | |
| fastcgi_param HTTPS $https if_not_empty; | |
| fastcgi_param HERD_HOME "/Users/USERNAME/Library/Application Support/Herd"; | |
| fastcgi_param REDIRECT_STATUS 200; | |
| fastcgi_param HTTP_PROXY ""; | |
| fastcgi_buffer_size 512k; | |
| fastcgi_buffers 16 512k; | |
| fastcgi_param SCRIPT_FILENAME "/Applications/Herd.app/Contents/Resources/valet/server.php"; | |
| fastcgi_param PATH_INFO $fastcgi_path_info; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With Laravel Herd, use this nginx configuration to create a UI proxy to a locally running js app with a Laravel backend API at /api. Not tested in any production environment.
https://serverfault.com/questions/405415/how-to-prevent-nginx-from-reverse-proxy-specific-subdirectories