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

Nginx recerse proxy configuration #2541

Closed
anmol26s opened this issue Apr 26, 2020 · 10 comments
Closed

Nginx recerse proxy configuration #2541

anmol26s opened this issue Apr 26, 2020 · 10 comments

Comments

@anmol26s
Copy link

Step 1: Please describe your environment

  • ZeroNet version: 0.7.1
  • Operating system: Debian
  • Web browser: ALL
  • Tor status: not available/always/disabled
  • Opened port: yes
  • Special configuration: nginx

Step 2: Describe the problem: I want to retrieve a Zeronet Yunohost package https://github.com/YunoHost-Apps/zeronet_ynh . Earlier it use to work, but in latest updates it gives blank page.

Steps to reproduce:

  1. Download the source from the Zeronet
  2. Add a Data folder in /home/user directory
  3. Create systemd for zeronet https://github.com/YunoHost-Apps/zeronet_ynh/blob/master/conf/systemd.service.template
  4. nginx configuration for Zeronet https://github.com/YunoHost-Apps/zeronet_ynh/blob/master/conf/nginx.conf.template

Observed Results:

  • What happened?
    It shows me blank page. The Zeronet is broken for now. It would be good if Nginx configuration file could be shared by someone. Systemd works smoothly and remains avtive.
@nomagics
Copy link

nomagics commented Apr 27, 2020

Well, first of all hello.

You should use Python3 instead of Python2 for that system service. I can share with you my system service and if needed than configuration for Apache2. I don't use nginx.

Also you could try to proxy to 127.0.0.1:43110/raw/bitcoinaddress instead of trying to proxy to the frame.

@nomagics
Copy link

nomagics commented Apr 27, 2020

I'm more than sure that if you set https://github.com/YunoHost-Apps/zeronet_ynh/blob/master/conf/nginx.conf.template to proxy requests for 127.0.0.1:43110/RAW/bitcoinaddress will work.

Your config should first UNSET headers on the back-end which shipped with ZeroNet (see UiRequest.py) and than SET new headers on the front-end.

@HelloZeroNet
Copy link
Owner

Here is an example configuration for Nginx that works with the latest, Python3 version of ZeroNet: https://zeronet.io/docs/faq/#how-to-configure-nginx-reverse-proxy-for-zeronet

@filips123
Copy link
Contributor

ZeroNet for YunoHost package is unmaintained and broken. I'm currently working on updating it so it will work with newer ZeroNet versions.

@nomagics
Copy link

@HelloZeroNet The nginx config has nothing to do with the version of python! I told him to use version 3 of python because @anmol26s's system service was clearly used python2 to start ZeroNet. In the other hand the headers should be unset on the back-end servers (where zeronet is running) before adding new headers on the front-end.

Proxypass should point to 127.0.0.1:43110/RAW/bitcoinaddress and not the framed version! (Frames can't be read by search engines, or at minimum they will penalize the website owner...)

Thanks @filips123

@anmol26s
Copy link
Author

@nomagics It did not worked.
@HelloZeroNet This configuration use to work, but now this configuration don't work.

@filips123
Copy link
Contributor

filips123 commented Apr 30, 2020

Are you trying to do this with YunoHost? Unfortunately, this won't work because YunoHost uses cookies for SSO and that cookies won't be included in ZeroNet's iframe so scripts won't load. See YunoHost/issues#1580 for more details.

I'm trying to update ZeroNet package and add more configuration options to it (like support for Multiuser plugin, public instances...), but this error is preventing from finishing it.

As possible workaround about this, you can try installing Multiuser plugin and then enabling public access to ZeroNet which probably means SSO cookies won't be needed.

@anmol26s
Copy link
Author

@Fil Yes I am trying it on YunoHost. Is Zeronet working after enabling multiuser plugin? What is the protecting way to a ZeroNet instance when its in public space?

@filips123
Copy link
Contributor

If it is working or not is not related to Multiuser/UiPassword plugin but if YunoHost restricts access behind SSO login.

I meant that you could try enabling public/unrestricted access to ZeroNet (with source /usr/share/yunohost/helpers && ynh_app_setting_set --app=$app --key=unprotected_uris --value="/", where $app is ZeroNet app ID from YunoHost), but restrict access to yourself with UiPassword plugin (I first wrongly said Multiuser).

@anmol26s
Copy link
Author

I am trying to fix app for Yunohost. For now I will keep the app away from SSO and provide the UI password for the protection of the Zeronet admin interface.
The problem I am facing is when I try to run Zeronet from the systemd there is an error.

Failed at step USER spawning /usr/bin/python3: No such process
Main process exited, code=exited, status=217/USER

I have no idea why this error comes when the user is already created and working. Zeronet work well when I run from command line. That is obvious that is a problem between Zeronet running with a system created user.
The new user is don't have home directory. Can this be a problem?

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

No branches or pull requests

4 participants