nginx.conf
---
events{}
http{
server{
listen 8080;
location / {
return 200 "Hello from NGINX\n";
}
}
}
---
nginx -c /Users/uday/nginx.conf
nginx -s reload
curl http://localhost:8080
test php server to use:
php -S localhost:9999
in the directory where it runs above command, the files are picked from there.
or else, you can pass a file as argument
response.txt
--
hello from php
php -S localhost:9999 response.txt
http://localhost:9999
other servers to test:
---------
https://gist.github.com/willurd/5720255
Reverse proxy:
--------
location /php {
proxy_pass http://localhost:9999/; //end slash is required else it will take original /php only as path
}
location /php {
add_header proxied nginx;//this will add header to client browser
proxy_pass http://localhost:9999/;
}
location /php {
proxy_set_header proxied nginx;//this will add header to proxy request
proxy_pass http://localhost:9999/;
}
No comments:
Post a Comment