0

This is my first time using Arch based Linux environment (Manjaro Linux), and also Nginx.

I installed Nginx, opened http://localhost and it showed the standard Welcome to Nginx page.

Then I created 2 folders:

  • /etc/nginx/sites-available
  • etc/nginx/sites-enabled

In sites-available, I created a conf file named iima, with following data:

server {
  listen 80;
  server_name iima.merged.localhost;
  passenger_enabled on;
  location / {
    root /home/path/redacted/public;
  }
}

and then created a symbolic link:

sudo ln -s /etc/nginx/sites-available/iima /etc/nginx/sites-enabled/iima

Then in the /opt/nginx/conf/nginx.conf, I added:

include       /etc/nginx/sites-enabled/*;

In the /etc/hosts, I added the following line at the end of the file:

127.0.0.1       iima.merged.localhost   iima.merged.localhost

# I also tried below line while removing above line
127.0.0.1       iima.merged.localhost

Restarted the nginx server using sudo systemctl restart nginx (also tried with reload), but typing iima.merged.localhost always points to localhost page.

Am I missing anything? There are no error(s).log created in /var/log/nginx.

EDIT:

Content of /opt/nginx/conf/nginx.conf

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    passenger_root /home/harsh/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/passenger-4.0.45;
    passenger_ruby /home/harsh/.rbenv/versions/1.8.7-p375/bin/ruby;

    include       mime.types;
    include       /etc/nginx/sites-enabled/*;
    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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;
        # server_name_in_redirect off;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   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   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;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}
Harsh Gupta
  • 4,348
  • 2
  • 25
  • 30
  • Did you install nginx with passenger? By default nginx don`t have directive `passenger_enabled`. And show you /etc/nginx/nginx.conf and other files from /etc/nginx/sites-available/ (if they exist). – mr_tron Jul 07 '14 at 14:17
  • @mr_tron, I added the `nginx.conf` to the post. I have alerady added the content of a single file in `/etc/nginx/sites-available/`. – Harsh Gupta Jul 07 '14 at 14:43
  • For creating error.log uncomment `error_log logs/error.log;`. But i don`t understand why you see default_page. Config is valid. Maybe file mode or owner for /etc/nginx/sites-available/iima and /etc/nginx/nginx.conf are different? – mr_tron Jul 07 '14 at 14:57
  • @mr_tron, File modes for `nginx.conf`, `/etc/hosts` and `sites-available/iima` are all `644` i.e. RW-R-R and owner are all root-root. – Harsh Gupta Jul 07 '14 at 15:22

0 Answers0