Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hosting Hastebin on Virtual Directory using NGINX #156

Open
Vexentric opened this issue May 26, 2017 · 11 comments
Open

Hosting Hastebin on Virtual Directory using NGINX #156

Vexentric opened this issue May 26, 2017 · 11 comments
Labels

Comments

@Vexentric
Copy link

I have my main website on the / location for my website and I wanted to host hastebin on /paste.
I tried it using ngix with the following location config:
location /paste { proxy_pass http://localhost:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 150; proxy_send_timeout 100; proxy_read_timeout 100; proxy_buffers 4 32k; client_max_body_size 8m; client_body_buffer_size 128k; }

However, it just turns out looking like this;
https://gyazo.com/0f50b9261a43a6cdc9e21d043190d7d6

Could someone help me fix this? (If it is possible to do)

@Logic-gate
Copy link

@Vexentric
Copy link
Author

It works now! Sadly the actual pasting part doesnt :(

I get this message: https://gyazo.com/0f237d18d027970f6b4bcc91b709f9d2

@Logic-gate
Copy link

Do you have redis running?

@Vexentric
Copy link
Author

No, I'm using a file storage system. If needed I can switch to redis.

@Logic-gate
Copy link

I'd suggest moving to redis as you will have the added advantage of setting expiration. But if you want file storage, change your logging to verbose if you changed it and paste the log. I think it's a file permission issue, not sure without looking at the log.

@vwbusguy
Copy link

vwbusguy commented Jul 3, 2017

I'm using haste server behind an nginx proxy. I didn't have to do anything elaborate (haste is running locally on 7777):

server{
	listen 80;
	server_name the.listening.domain;

	location /{
		proxy_pass "http://localhost:7777/";
	}
}

I have a redis backend as well, but that was inconsequential as nginx doesn't need to know about it.

EDIT - try putting a trailing slash at the end of your proxy_pass.

@Logic-gate
Copy link

@Vexentric Ping

@didyouexpectthat
Copy link

Hi,
I use nginx with SSL redirect (on vestacp, but you need profiles setup to do the proxy stuff).
My SSL config is :

server {
    listen      $IP:443;
    server_name $servername;
    ssl         on;
    ssl_certificate      /home/$user/conf/web/ssl.$servername.pem;
    ssl_certificate_key  /home/$user/conf/web/ssl.$servername.key;
    error_log  /var/log/apache2/domains/$servername.error.log error;

    location / {
        proxy_pass      http://$IP:7777;
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
            root           /home/$user/web/$servername/public_html;
            access_log     /var/log/apache2/domains/$servername.log combined;
            access_log     /var/log/apache2/domains/$servername.bytes bytes;
            expires        max;
            try_files      $uri @fallback;
        }
    }

    location /error/ {
        alias   /home/$user/web/$servername/document_errors/;
    }

    location @fallback {
        proxy_pass      http://$IP:7777;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

}

@etylermoss
Copy link

This still seems to be an issue. When trying to put Hastebin under a virtual directory such as /hastebin/, references in the frontend seem to be absolute assuming hastebin is at /. Setting "host" in config.js to "127.0.0.1/hastebin" also doesn't solve the issue (a solution that was required for me on another similar application). The solution (hack) proposed here is no longer an option since the repository holding that patch was deleted.

@github-actions
Copy link

github-actions bot commented Mar 8, 2022

This issue is stale because it has been open for 30 days with no activity.

@filipechagas
Copy link
Contributor

The app now supports baseUrl: #140

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants