# How do you get to the Nginx configuration

• I i decided to get a website up so i can play with the files but i've ran into a snag. How do you edit the nginx configuration file? My website still needs the port number.

I've been reading all of your tutorials but this step is usually unexplained because it's too easy.

californiamotorcycleforum.com:4567

• What do you mean by the nginx configuration file? Are you using nginx to route to your nodebb setup?

• Yes. exactly. I've been trying to follow the way you guys have been doing it.

• I haven't been using nginx, however I should be. Have you tried the nginx guide in the NodeBB Github Wiki?

• Yep. I need someone to break down that step one step more. Where is it i'm entering that code and how do i get there?

• @kevin, the nginx configuration files are placed differently depending on the operating system you are using.

Perhaps try /etc/nginx?

$cd /etc/nginx/$ ls    # you should see a "sites-enabled" directory, maybe?


Put your file in sites-enabled.

• This post is deleted!

• Okay, found the directory /etc/nginx/sites-enabled

Figured out how to edit/write files using the terminal. Not sure what to name the file though.

Sorry. I'm really bad at this.

• @kevin you shouldn't edit /etc/nginx/sites-enabled directly.

The normal flow of enabling sites is

• nano /etc/nginx/sites-available/<site-name>
• write config
• ln -s /etc/nginx/sites-available/<site-name> /etc/nginx/sites-enabled/<site-name>

This creates a symbolic link to the file in sites-available. Anyway, the default config is usually in the default file, other than that a good convention can be <subdomain>.<domain>, or in your case just californiamotorcycleforum.com

• @barveyhirdman said:

@kevin you shouldn't edit /etc/nginx/sites-enabled directly.

The normal flow of enabling sites is

• nano /etc/nginx/sites-available/<site-name>
• write config
• ln -s /etc/nginx/sites-available/<site-name> /etc/nginx/sites-enabled/<site-name>

This creates a symbolic link to the file in sites-available. Anyway, the default config is usually in the default file, other than that a good convention can be <subdomain>.<domain>, or in your case just californiamotorcycleforum.com

For some reason when I did the symbolic link nginx didn't pick it up, I had to just copy the file from sites-available to sites-enabled.

• @skaughtx0r yeah sometimes it's the same for me, not sure what causes it. But yeah, if it doesn't work, you can just copy it. It's just more consistent if you edit the file in sites-available and not the one in sites-enabled directly.

• @barveyhirdman Nice catch. Definitely use ln -s to link to the actual file in sites-available.

@kevin -- just name it anything... no extension required either.

• okay got the two files linked and in the right directory. nginx wont run though. gotta figure out that now.

• @kevin - cool. Try this (using sudo or as root user): nginx -t

It will check your nginx configuration file, and let you know what went wrong.

•  root@motor:~# sudo service nginx start
Starting nginx: nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
nginx: configuration file /etc/nginx/nginx.conf test failedmaybe?


• @kevin You can insert the given directive to the nginx.conf file

First open the configuration file:
nano /etc/nginx/nginx.conf

Then check if the directive server_names_hash_bucket_size already exists. If it does, just change the value to 32 or 64 if you still get the error with 32.

If you don't have the given line, look for

http {


And add it to the next row:

http {
server_names_hash_bucket_size 32;


(Or 64, as said above)

Try to verify the config now, it should work.

• whats funny is it already states 64.

• @kevin that's somewhat surprising, but you can still use 128.

• fixed it. There was a hashtag in the line "server_names_hash_bucket_size " by default. just had to remove it.

• @kevin nice, welcome to the glorious world of unnoticeable comment characters!

4

25

21

6

6
| |