How to execute shell commands via https request (nginx,PHP)?

General support questions
Post Reply
Marcophono
Posts: 1
Joined: 2018/07/07 02:16:43

How to execute shell commands via https request (nginx,PHP)?

Post by Marcophono » 2018/07/07 02:47:15

Hello!

I want to make my webserver (ngnix) able to transfer GET values to the internal Linux system to execute certain Linux commands.

Example:
https://www.domain.de/doit.php?x=y

shall execute a shell script which cut the line in the webserver log file of its own request and copy it to another log file.
Yes, that is a sophisticated task. But just to make it a bit interesting. :-)
I am interested in the more simple basic blocks. How and where must I adjust permission rights to give a certain file in a webserver folder the right to call a shell script?

I am on beginner level, so please be gracious with me. I am a good PHP programmer but nothing else.

Best regards
Marc

tunk
Posts: 1205
Joined: 2017/02/22 15:08:17

Re: How to execute shell commands via https request (nginx,PHP)?

Post by tunk » 2018/07/07 14:32:42

If you haven't already looked at it, you may want to look into CGI.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to execute shell commands via https request (nginx,PHP)?

Post by TrevorH » 2018/07/07 16:05:04

You might also want to stop and think how much of a massive security hole you are creating...
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: How to execute shell commands via https request (nginx,PHP)?

Post by hunter86_bg » 2018/07/09 04:39:57

Not to mention that you will have to disable SELINUX.
Anyway - we have ssh for such tasks.

Post Reply