Nginx cannot listen to port 8090

Hello all,

I am trying to enable nginx to listen to port 8090 via default.conf
file
under /etc/nginx/conf.d directory but it fails with following error :

– Unit nginx.service has begun starting up.
Sep 29 01:13:58 spidrproxy.netas.lab.nortel.com nginx[7284]: nginx: the
configuration file /etc/nginx/nginx.conf syntax is ok
Sep 29 01:13:58 spidrproxy.netas.lab.nortel.com nginx[7284]: nginx:
[emerg]
bind() to 0.0.0.0:8090 failed (13: Permission denied)
Sep 29 01:13:58 spidrproxy.netas.lab.nortel.com nginx[7284]: nginx:
configuration file /etc/nginx/nginx.conf test failed
Sep 29 01:13:58 spidrproxy.netas.lab.nortel.com systemd[1]:
nginx.service:
control process exited, code=exited status=1
Sep 29 01:13:58 spidrproxy.netas.lab.nortel.com systemd[1]: Failed to
start
nginx - high performance web server.
– Subject: Unit nginx.service has failed
– Defined-By: systemd
– Support: systemd-devel Info Page

– Unit nginx.service has failed.

– The result is failed.
Sep 29 01:13:58 spidrproxy.netas.lab.nortel.com systemd[1]: Unit
nginx.service entered failed state.

[root@spidrproxy conf.d]#

default.conf file is as below :

server {
listen 8090;
server_name 47.168.136.70;

#charset koi8-r;
#access_log  /var/log/nginx/log/host.access.log  main;

location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
}

#error_page  404              /404.html;

# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
#    proxy_pass   http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
#    root           html;
#    fastcgi_pass   127.0.0.1:9000;
#    fastcgi_index  index.php;
#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
#    include        fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
#    deny  all;
#}

}

Posted at Nginx Forum:

Looks like SELinux/AppArmor problem.

2014-09-29 1:15 GMT+03:00 mert1972 [email protected]:

Thanks Anton for your response,
Would you please provide some hints about how I can overcome this issue.
This is a newly built Centos 7 system, I am a bit new to Centos.

Best Regards,
Volkan.

Posted at Nginx Forum:

Are you familiar with SELinux? If not, just disable it :slight_smile:
Try run ‘getenforce’ (without quotes) on your console, it must be
enforcing.

Thanks a lot Anton and dewanggaba,
it worked after disabling Selinux on the system.

Your kind support is highly appreciated.
Best Regards,

Posted at Nginx Forum:

Take a look at /etc/sysconfig/selinux and this link
HowTos/SELinux - CentOS Wiki (you can create custom policy
which will allow nginx to bind to nonstandard port).

2014-09-29 14:31 GMT+03:00 mert1972 [email protected]: