How do you get to the Nginx configuration


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

    upstream nodebb {
        server 198.199.96.7:4567
    }
    
    server {
        listen 80;
    
        server_name californiamotorcycleforum.com;
        root /path/to/nodebb/install;
    
        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
    
            proxy_pass http://nodebb/;
            proxy_redirect off;
    
            # Socket.IO Support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
    

    /etc/nginx/sites-available/default

    # You may add here your
    # server {
    #	...
    # }
    # statements for each of your virtual hosts to this file
    
    ##
    # You should look at the following URL's in order to grasp a solid understanding
    # of Nginx configuration files in order to fully unleash the power of Nginx.
    # http://wiki.nginx.org/Pitfalls
    # http://wiki.nginx.org/QuickStart
    # http://wiki.nginx.org/Configuration
    #
    # Generally, you will want to move this file somewhere, and start with a clean
    # file but keep this around for reference. Or just disable in sites-enabled.
    #
    # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
    ##
    
    server {
    	#listen   80; ## listen for ipv4; this line is default and implied
    	#listen   [::]:80 default ipv6only=on; ## listen for ipv6
    
    	root /usr/share/nginx/www;
    	index index.html index.htm;
    
    	# Make site accessible from http://localhost/
    	server_name localhost;
    
    	location / {
    		# First attempt to serve request as file, then
    		# as directory, then fall back to index.html
    		try_files $uri $uri/ /index.html;
    		# Uncomment to enable naxsi on this location
    		# include /etc/nginx/naxsi.rules
    	}
    
    	location /doc/ {
    		alias /usr/share/doc/;
    		autoindex on;
    		allow 127.0.0.1;
    		deny all;
    	}
    
    	# Only for nginx-naxsi : process denied requests
    	#location /RequestDenied {
    		# For example, return an error code
    		#return 418;
    	#}
    
    	#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/www;
    	#}
    
    	# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    	#
    	#location ~ \.php$ {
    	#	fastcgi_split_path_info ^(.+\.php)(/.+)$;
    	#	# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    	#
    	#	# With php5-cgi alone:
    	#	fastcgi_pass 127.0.0.1:9000;
    	#	# With php5-fpm:
    	#	fastcgi_pass unix:/var/run/php5-fpm.sock;
    	#	fastcgi_index index.php;
    	#	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;
    #	root html;
    #	index index.html index.htm;
    #
    #	location / {
    #		try_files $uri $uri/ /index.html;
    #	}
    #}
    
    
    # HTTPS server
    #
    #server {
    #	listen 443;
    #	server_name localhost;
    #
    #	root html;
    #	index index.html index.htm;
    #
    #	ssl on;
    #	ssl_certificate cert.pem;
    #	ssl_certificate_key cert.key;
    #
    #	ssl_session_timeout 5m;
    #
    #	ssl_protocols SSLv3 TLSv1;
    #	ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
    #	ssl_prefer_server_ciphers on;
    #
    #	location / {
    #		try_files $uri $uri/ /index.html;
    #	}
    #}
    

    /etc/nginx/nginx.conf

    user www-data;
    worker_processes 4;
    pid /var/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;
    
    	##
    	# 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/x-javascript text/xml application/xml application/xml+rss text/javascript;
    
    	##
    	# nginx-naxsi config
    	##
    	# Uncomment it if you installed nginx-naxsi
    	##
    
    	#include /etc/nginx/naxsi_core.rules;
    
    	##
    	# nginx-passenger config
    	##
    	# Uncomment it if you installed nginx-passenger
    	##
    	
    	#passenger_root /usr;
    	#passenger_ruby /usr/bin/ruby;
    
    	##
    	# Virtual Host Configs
    	##
    
    	include /etc/nginx/conf.d/*.conf;
    	include /etc/nginx/sites-enabled/*;
    }
    
    
    #mail {
    #	# See sample authentication script at:
    #	# http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
    # 
    #	# auth_http localhost/auth.php;
    #	# pop3_capabilities "TOP" "USER";
    #	# imap_capabilities "IMAP4rev1" "UIDPLUS";
    # 
    #	server {
    #		listen     localhost:110;
    #		protocol   pop3;
    #		proxy      on;
    #	}
    # 
    #	server {
    #		listen     localhost:143;
    #		protocol   imap;
    #		proxy      on;
    #	}
    #}
    

  • @kevin this seems fine, although root should be the actual path to your nodebb install, but don't think that changes anything.

    Could you paste the public/config.json file from your nodebb dir? If I'm not mistaken fresh configs only contain the relative_path item.


  • @BarveyHirdman

    /root/mynodebb/public/config.json

    {
        "relative_path": ""
    }
    

  • He will need to add the root path in for his nodebb install.
    Also, make sure you clear your cache. I was having problems with changes to NodeBB and nginx not taking effect until i cleared the cache.


  • @Scuzz, How do i do that?


  • Registered an account on your site and logged in fine. Not sure what can cause the issue for you but it might be client-side.


  • @BarveyHirdman did you do it with the ip address or the URL?



  • Depends on the browser.

    Try ctrl+f5 or shift+f5

    @barveyhirdman
    It doesnt work for me on the URL. The numbers do not appear at the bottom of the page.

    @kevin

    Firefox

    Chrome

    You need to change this line:

    root /path/to/nodebb/install;
    

    In your sites-available to the location of your nodebb install too. Then restart nginx.


  • Oh, yeah i know how to clear the browser cache. I thought you meant some other cache on the website.

    So maybe this'll show what i mean

    This is the ip address
    Screen Shot 2014-01-15 at 1.49.07 AM.png

    This is californiamotorcycleforum.com
    Screen Shot 2014-01-15 at 1.49.22 AM.png

    ip address
    Screen Shot 2014-01-15 at 1.50.06 AM.png

    californiamotorcycleforum.com
    Screen Shot 2014-01-15 at 1.49.36 AM.png

    if you notice that certain features stop working. In the url it won't show that i'm logged in. It wont show the forum stats. It wont show if someone is online or offline.



  • @BarveyHirdman
    huh.... now i'm confused. It's still doing it across all browsers after clearing everything, logging out, logging back in. No changes. Your fonts look different too.


  • @Scuzz

    okay so i should change

    root /path/to/nodebb/install;

    to

    root /root/mynodebb/install/; ??


  • @kevin I have to wait a couple of seconds until socket.io falls back to XHR polling instead of using websockets, since I can't connect to websockets from my workplace. Does waiting 9-10 seconds help?


  • @barveyhirdman
    Im not getting that :S, this is weird.

    Try setting the server to

    127.0.0.1:4567;
    

    See my root? That is the location of the NodeBB install. But that doesnt seem to matter like i thought it did as mine is in a different location and still works.

    upstream nodebb {
    server 127.0.0.1:4567;
    }
    
    server {
    listen 80;
    
    server_name www.bitbangers.co.uk bitbangers.co.uk;
    root /var/www/bitbangers.co.uk/NodeBB;
    
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
    
        proxy_pass http://nodebb/;
        proxy_redirect off;
    
        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
    
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    
                # With php5-cgi alone:
                #fastcgi_pass 127.0.0.1:9000;
                # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
    }
    

  • @BarveyHirdman, no keeping the browser on the homepage for over 20 seconds doesnt seem to do anything.

    @Scuzz, I think i understand. one sec..


  • @scuzz yeah i have no idea if i'm doing this correctly.

    root 198.199.96.7/root/mynodebb/install/; ???


  • @kevin What is the location of your nodebb folder?

    On my server the nodebb folder where the nodebb app is is in

    /var/www/bitbangers.co.uk/htdocs/NodeBB
    

    As shown above, mine is incorrect so that shouldnt make a difference. But you might want to change it anyway just in case it is causing a problem.

    Change

    upstream nodebb {
        server 198.199.96.7:4567
    }
    

    to

    upstream nodebb {
        server 127.0.0.1:4567;
    }
    

    You also missed off a ; in your config when declaring the server ipaddress.


  • @Scuzz its root/mynodebb/
    I followed the NodeBB for dummies tutorial and installed it in "mynodebb"

    and thanks seeing the missing ";"
    not sure why that's missing. The actual doc itself has it.


  • @kevin

    Ok. Did you change it to the ip address i mentioned above?
    You will need to restart nginx for these changes to take effect.

Suggested Topics

| |