Can't Start Nginx: "server" directive is not allowed here

GarrettG

I am trying to get a passenger + nginx instance running. Passenger has been successfully installed however, when going to to http://lakemagazine.northcentralus.cloudapp.azure.com/ we are receiving a time out error. So, I looked at nginx:

garrett@lakemag:~$ sudo nginx -t
nginx: [emerg] "server" directive is not allowed here in /etc/nginx/nginx.conf:65
nginx: configuration file /etc/nginx/nginx.conf test failed

Thus, nginx is not running, which I assume is my problem.

Here is my nginx.conf file:

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

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

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml applic$

    ##
    # Virtual Host Configs
    ##

    #include /etc/nginx/conf.d/*.conf;
    #include /etc/nginx/sites-enabled/*;
server {
    listen 80;
    server name http://lakemagazine.northcentralus.cloudapp.azure.com/;

    root /lakemag/public;

    passenger_enabled on;
    passenger_ruby /home/garrett/.rvm/gems/ruby-2.3.0/wrappers/ruby;
    }

}

Line 65 is where my server {} block starts. I am at a loss to my problem - all of the blocks seem to be defined appropriately to me. am I missing something?

*EDIT:

garrett@lakemag:~$ sudo nginx -t
[sudo] password for garrett:
nginx: [warn] server name "http://lakemagazine.northcentralus.cloudapp.azure.com/" has suspicious symbols in /etc/nginx/nginx.conf:65
nginx: [emerg] unknown directive "passenger_enabled" in /etc/nginx/nginx.conf:69
nginx: configuration file /etc/nginx/nginx.conf test failed

After Jorge's solution I am now receiving the above errors.

Jorge Vargas

Where says:

server name http://lakemagazine.northcentralus.cloudapp.azure.com/

should say:

server_name http://lakemagazine.northcentralus.cloudapp.azure.com/

server is a directive to define a server block and to identify what server is you should write a server_name directive into it

http://nginx.org/en/docs/http/server_names.html

To check config file syntax use:

nginx -t

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

NGINX - "server" directive is not allowed here

From Java

nginx: [emerg] "server" directive is not allowed here

From Dev

nginx "env" directive is not allowed here

From Dev

nginx directive is not allowed here in unicorn's example nginx.conf

From Dev

"set" directive is not allowed here

From Dev

nginx: [emerg] "worker_processes" directive is not allowed here in /opt/tools/nginx/conf/nginx.conf:1

From Dev

nginx: [emerg] "location" directive is not allowed here in /etc/nginx/conf.d/default.conf:1

From Dev

Can't restart NGINX server

From Dev

flask - Server can't start

From Dev

RSelenium, Can't start server

From Dev

Foreverjs can't start server

From Dev

Can't start symfony server

From Dev

Nginx is down and I can't start it

From Dev

Can't start nginx - no errors anywhere

From Dev

Nginx: Why the index directive can't work, 403 forbidden?

From Dev

apache2 can't stop and nginx can't start

From Dev

500 Error on apache server - "AllowOverride not allowed here"

From Dev

500 Error on apache server - "AllowOverride not allowed here"

From Java

Can't create Lombok class inside my test class: modifier static not allowed here

From Dev

JBoss AS 7 and MySQL - Can't start server

From Dev

Can't start the karma server in angular

From Dev

Wamp server can't start (orange icon)

From Dev

Can't start MySQL server for the first time

From Dev

isc-dhcp-server can't start

From Dev

I can't get rails server to start

From Dev

Ruby error, can't start the rails server

From Dev

Can't start MySQL server (database corruption)

From Dev

Can't start Minecraft server in tmux with systemctl

From Dev

SAP Can't start application server

Related Related

HotTag

Archive