[Tanya] Nginx reverse proxy config


Status
Not open for further replies.

rizkyprogrammer

Beginner 2.0
Saya ingin membuat reverse proxy, jadi ketika akses http://domain.com:10000 akan di truskan https://192.168.7.23:10000 berikut adalah config saya :

server {
listen 10000;
server_name domain.com;
location / {
proxy_pass https://192.168.7.23:10000;
proxy_redirect http://domain.com:10000 https://192.168.7.23:10000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

namun setelah saya restart muncul error
# systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.


Pertanyaan saya kira-kira apa ya yang salah dengan config saya tersebut,,

Terima kasih sebelumnya
 

rizkyprogrammer

Beginner 2.0
Terimakasih atas responnya @masiqbal

untuk resultnya masih tetap sama mas,,
# systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
 

masiqbal

Hosting Guru
Verified Provider
coba cari clue di /var/log
itu tadi seluruh isi nginx.conf atau di file apa?

kalau perintah "nginx -t" (atau mungkin harus full path coba cari dimana) hasilnya apa? Ini untuk ngetest file config bener apa enggak.
 

rizkyprogrammer

Beginner 2.0
Terima kasih atas responnya mas @hendranata

outputnya seperti berikut :
# systemctl status nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Rab 2016-09-21 11:58:21 WIB; 1h 57min ago
Process: 6755 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 8089 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
Process: 8086 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 6756 (code=exited, status=0/SUCCESS)

Sep 21 11:58:21 urbanlifestore.com systemd[1]: Starting The nginx HTTP and reverse proxy server...
Sep 21 11:58:21 urbanlifestore.com nginx[8089]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Sep 21 11:58:21 urbanlifestore.com nginx[8089]: nginx: [emerg] bind() to 0.0.0.0:10000 failed (13: Permission denied)
Sep 21 11:58:21 urbanlifestore.com nginx[8089]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 21 11:58:21 urbanlifestore.com systemd[1]: nginx.service: control process exited, code=exited status=1
Sep 21 11:58:21 urbanlifestore.com systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Sep 21 11:58:21 urbanlifestore.com systemd[1]: Unit nginx.service entered failed state.
Sep 21 11:58:21 urbanlifestore.com systemd[1]: nginx.service failed.


Outpur dari /var/log/nginx/error.log
2016/09/21 11:31:46 [emerg] 7090#0: bind() to 0.0.0.0:10000 failed (13: Permission denied)
2016/09/21 11:57:57 [emerg] 8048#0: bind() to 0.0.0.0:10000 failed (13: Permission denied)
2016/09/21 11:58:21 [emerg] 8089#0: bind() to 0.0.0.0:10000 failed (13: Permission denied)
 

rizkyprogrammer

Beginner 2.0
output dari # nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
 

masiqbal

Hosting Guru
Verified Provider
Ini pakai centos/rhel 7 ya?
Coba tambahkan port 10000 dengan semanage

semanage port -a -t http_port_t -p tcp 10000

Jangan lupa juga buka port 10000 di firewall
 

rizkyprogrammer

Beginner 2.0
terimakasih @masiqbal sdah work untuk akses ke port 10000

namun skarang ada lagi trouble mas, ketika saya login di port 10000 (virtualmin)
muncul pesan sebagai berikut :

Error - No cookies
Your browser does not support cookies, which are required for this web server to work in session authentication mode

Apakah ada yang kurang ya diconfig saya tadi?
 
Status
Not open for further replies.

Top