How to put the Forums in a directory instead of homepage
-
Ok Forums.com/forums works. And I see the Nginx homepage for forums.com. How do I edit the homepage with html?
-
Well, you can have anything as the homepage. For example, a Ghost blog that can integrate with NodeBB for comments. However, if you prefer just a static index.html file, see NGINX Docs | Serving Static Content, or as an example nginx config for static site.
-
Do I make a new file in sites-available with the new configuration. Or just add to the Forums.com one
-
Probably you have a line like:
include /etc/nginx/sites-enabled/*;
in /etc/nginx/nginx.conf. So you can choose to have the configuration in one or several files. Maybe in this case it's simpler to add it to the existing file in sites-available, that will already have a symlink in sites-enabled.
-
The
include
line? Probably it's already there. It just means that all files or symlinks in sites-enabled will be included as Nginx configuration.Your site config (in the other file we mentioned) probably will be something like:
server { ... location /forums/ { ... } location / { ... } }
-
It was already in Nginx.conf. Now when I go to Forums.com I get error 500 internal server error
-
server {
listen 80;index index.html index.htm; server_name wowbad.ml; location /forums/ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:4567; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location / { default_type "text/html"; try_files $uri.html $uri/ /index.html; }
}
-
There is another possible problem:
@whimpers said in How to put the Forums in a directory instead of homepage:
try_files $uri.html $uri/ /index.html;
It looks like this line can cause that error if
/index.html
can't be accessed, maybe because of permission or owner problems, if theroot
line is correct.Since
index.html
is already inindex
, you can try something simpler like:try_files $uri $uri/ =404;
This will give a 404 not found until you fix the permissions problem. Try
chmod 777 index.html
(from its folder) to see if this is the case. Then change the owner (probably a user sharing a group with thewww-data
user mentioned in nginx.conf) to be able to use the safer664
.