无法从外部访问nginx服务器

use*_*992 0 centos nginx data-science-studio

我最近不得不在centOS 7服务器上设置一个nginx服务器.为了运行dataiku软件.

每件事似乎都运行良好,但一旦我尝试访问页面,我绝对没有.

在本地的elinks我设法得到nginx默认网页,但不是从我的浏览器,所以我认为它来自我的nginx配置.

这是我的nginx.conf:

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
worker_connections  1024;
}



 http {
include       /etc/nginx/mime.types;
default_type  application/octet-stream;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;

sendfile        on;
#tcp_nopush     on;

keepalive_timeout  65;

#gzip  on;

include /etc/nginx/conf.d/*.conf;
}
Run Code Online (Sandbox Code Playgroud)

这是default.conf包含的文件:

server {
    listen       80 default;
    server_name _;
    #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;
#}
}
Run Code Online (Sandbox Code Playgroud)

我真的需要这台服务器正常运行并且可以访问你有什么想法吗?

谢谢你的阅读.

君主不*_*不是你 8

你应该在公共区域添加一个新规则,因为CentOS 7有一个firewalld.尝试:

firewall-cmd --zone=public --add-service=http
Run Code Online (Sandbox Code Playgroud)

然后去吧!