kippa
April 8, 2022, 1:42pm
1
Can anybody help please. I’m trying to set up the nginx.conf file with:
upstream tomcats {
server <TARGET_SERVER>:8009;
keepalive 10;
}
server {
listen 80;
location / {
ajp_keep_conn on;
ajp_pass tomcats;
}
}
I comment out the entire server block and append the above in the
http block. I then add the IP address and port of my target, replacing
<TARGET_SERVER>:8009, but I just can’t get it to work.
Please can someone give me a little guidance on this.
Many Thanks
kippa
Apologies, please ignore, I missed commenting out a curly brace.
listen 80;
is supposed to be changed. Look at the note below it:
Note: If you are using Pwnbox, then port 80 will be in use already, so, in the above configuration change port 80 to 8080. Finally, in the next step, use port 8080 with cURL.
kippa
April 8, 2022, 1:54pm
3
Many thanks onthesauce, that solved my next question. I got the port
80 error after sorting out a missed brace that I should have commented out to solve my previous issue.
Ta
kippa
No worries! Sounds like a pre-coffee mistake haha!
kippa
April 8, 2022, 1:58pm
5
You’re not far off, coffee gone cold error
Im getting 504 Gateway Time-out
any help with this?
thanks
Are you using the pwnbox?
Yes, i just dowload the parrot HTB OS to try, but i changed the port to 8080 and then curl localhost:8080
Just to clarify, you are using their hosted pwnbox right? Not a VM on your own network? For some reason it doesn’t work as well via the VPN.
Post the upstream and server configuration you are using!
Correct, i tried witha VM and it does not work,
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
#server {
# listen 80;
# server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
#location / {
#root html;
#index index.html index.htm;
#}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
#root html;
#}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
#}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
upstream tomcats {
server 161.35.173.232:8009;
keepalive 10;
}
server {
listen 8080;
location / {
ajp_keep_conn on;
ajp_pass tomcats;
}
}
}
Don’t use a VM, try it again on HTB’s hosted pwnbox.
This all looks good. Just try it on a pwnbox and you should see some results.
I did and all i get is the same error
What url are you curling to get the results?
Any errors when you launch nginx?
@ajauregui0 Whoops, I musta missed it. You didn’t put the target servers port in there! 8009 needs to be replaced with the port from the target server.
no, i keep geting the same error
linyera
January 5, 2023, 11:24am
20
Could somebody drop a hint on this? I´m getting the same 504 error
Thanks in advance!