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 Install Script #4

Open
YSpoof opened this issue Oct 6, 2021 · 11 comments
Open

NGINX Install Script #4

YSpoof opened this issue Oct 6, 2021 · 11 comments
Assignees

Comments

@YSpoof
Copy link

YSpoof commented Oct 6, 2021

It auto aborts the operation due to a missing '-y' on 'apt install nginx' line 9 ??? Since it cancels out the installation due to running next commands ( At least for me ).

@YSpoof
Copy link
Author

YSpoof commented Oct 6, 2021

Also, NGINX try to start on port 80 but I have Apache running, so I've needed to manually edit the NGINX config and remove that, maybe some option during the setup to ask if the user wants that ;)

@YSpoof
Copy link
Author

YSpoof commented Oct 6, 2021

BTW, Android still can't connect :( I dunno why.

@YSpoof
Copy link
Author

YSpoof commented Oct 6, 2021

2021/10/06 10:59:00 [error] 830507#830507: *27 upstream timed out (110: Connection timed out) while proxying connection, client: HIDDEN_IP, server: 0.0.0.0:853, upstream: "127.0.0.1:53", bytes from/to client:56/0, bytes from/to upstream:0/0

@clayauld
Copy link
Owner

clayauld commented Oct 7, 2021

Thanks for the feedback. I'll run tests and fix the script. I posted the changes without adequate testing, and was hoping it would "just work". Looks like I need to fix it!

And, yes, I'd like to add some options in the install script, including asking for the correct domain name for the VPS or server, nginx port, etc. I put the script together kinda quickly, so it was a first attempt.

Feel free to make changes to the script and fix it if you have time. I can merge PRs quickly if you have the time to create one.

@YSpoof
Copy link
Author

YSpoof commented Oct 7, 2021 via email

@clayauld clayauld self-assigned this Oct 7, 2021
@YSpoof
Copy link
Author

YSpoof commented Oct 8, 2021

Remove line 14 from NGinx Install.sh

"systemctl restart nginx"

Since the user will need to setup the certificate and the script will throw an error:

Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.

@clayauld
Copy link
Owner

clayauld commented Oct 8, 2021

I updated the install script with your suggestions.

@YSpoof
Copy link
Author

YSpoof commented Oct 13, 2021

Cool, I c, now what would be awesome is the script pulling 2 nginx.conf, 1 for people who is already running another service on port 80 ( the warning u put is good, but people need to manuallly remove the http block from nginx.conf ) with http block removed from the nginx.conf, and other for people not running any service on port 80 ( the one u already have ).

@YSpoof
Copy link
Author

YSpoof commented Oct 14, 2021

@clayauld need to chmod +x /usr/local/bin/transparent-proxy inside the install.sh :

root@cenarioserver /home/zero 29s
❯ systemctl status transparent-proxy.service
● transparent-proxy.service - A script to enable transparent Nginx proxy
Loaded: loaded (/lib/systemd/system/transparent-proxy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2021-10-13 21:43:23 -03; 36s ago
Process: 627444 ExecStart=/usr/local/bin/transparent-proxy (code=exited, status=203/EXEC)
Main PID: 627444 (code=exited, status=203/EXEC)
CPU: 1ms

out 13 21:43:23 cenarioserver systemd[1]: Started A script to enable transparent Nginx proxy.
out 13 21:43:23 cenarioserver systemd[627444]: transparent-proxy.service: Failed to locate executable /usr/local/bin/transparent-proxy: Permission denied
out 13 21:43:23 cenarioserver systemd[627444]: transparent-proxy.service: Failed at step EXEC spawning /usr/local/bin/transparent-proxy: Permission denied
out 13 21:43:23 cenarioserver systemd[1]: transparent-proxy.service: Main process exited, code=exited, status=203/EXEC
out 13 21:43:23 cenarioserver systemd[1]: transparent-proxy.service: Failed with result 'exit-code'.

C this line :

out 13 21:43:23 cenarioserver systemd[627444]: transparent-proxy.service: Failed at step EXEC spawning /usr/local/bin/transparent-proxy: Permission denied

and after chmodding it, it works but if there are some way to fix this :

out 13 21:47:16 cenarioserver systemd[1]: transparent-proxy.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
out 13 21:47:16 cenarioserver systemd[1]: transparent-proxy.service: Failed with result 'exit-code'.

BTW appending exit 0 to transparent-proxy doesn't solve that status=2.

@clayauld
Copy link
Owner

I updated the install script with the suggested line. When I run the command sudo systemctl status transparent-proxy I get the following log:

● transparent-proxy.service - A script to enable transparent Nginx proxy
     Loaded: loaded (/lib/systemd/system/transparent-proxy.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Wed 2021-10-13 17:56:00 AKDT; 2min 16s ago
   Main PID: 985 (code=exited, status=0/SUCCESS)

Oct 13 17:56:00 dns1.pi.hole systemd[1]: Started A script to enable transparent Nginx proxy.
Oct 13 17:56:00 dns1.pi.hole transparent-proxy[986]: net.ipv4.conf.default.route_localnet = 1
Oct 13 17:56:00 dns1.pi.hole transparent-proxy[987]: net.ipv4.conf.all.route_localnet = 1
Oct 13 17:56:00 dns1.pi.hole systemd[1]: transparent-proxy.service: Succeeded.

This is the expected behavior as the service only needs to run the script once on boot. There should be no ongoing, active service in the background.

After you make sure the executable has the 'exec' flag set, reboot your system and see if the service gives you the same error.

@clayauld
Copy link
Owner

Cool, I c, now what would be awesome is the script pulling 2 nginx.conf, 1 for people who is already running another service on port 80 ( the warning u put is good, but people need to manuallly remove the http block from nginx.conf ) with http block removed from the nginx.conf, and other for people not running any service on port 80 ( the one u already have ).

I'll see about adding this as an option. It may take a bit for me to get it done and uploaded.

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

No branches or pull requests

2 participants