Welcome! Log In Create A New Profile


New installation gives 404 not found

Posted by BenEngbers 
New installation gives 404 not found
May 10, 2022 02:37PM

I installed nginx 1.21.6 on my Fedora workstation. The goal is to use nginx as a local testplatform for (Rest)webservices.

I used the instruction I found at `https://www.linuxcapable.com/how-to-install-nginx-on-fedora-35/` for setting up the configuration files. The only deviation from those instructions is that instead of using /var/www/be-logic/html, I created a symbolic link to ~/be-logic. I already saw that in order to use this path, I had to add the following line to nginx.conf:
`disable_symlinks off;'

This is my nginx.conf:

# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
worker_connections 1024;

http {
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 /var/log/nginx/access.log main;

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;

disable_symlinks off;

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

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.

# include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*.conf;

server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;

# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
error_page 404 /404.html;
location = /404.html {
error_page 500 502 503 504 /50x.html;
location = /50x.html {

And this is /etc/nginx/sites-available/be-logic.conf:

server {
listen 80;
listen [::]:80;

# root /var/www/your_domain/html;
root /var/www/be-logic/html;
autoindex on;
index index.html index.htm;

location / {
try_files $uri $uri/ =404;

`sudo nginx -t` tells me that the syntax for the configuration files is OK and that the configuration test executes well.
However http://be-logic returns 404 not found.

Did I miss something somewhere?

Re: Permission denied was "New installation gives 404 not found"
May 12, 2022 11:31AM
I have
- created a new user <nginx-user>
- changed the first line in nginx.conf to "user <nginx-user> <nginx-user>"
- sudo chown -R "$USER":<nginx-user> /var/www/be-logic
- sudo chown -R "$USER":<nginx-user> ~/be-logic
- sudo chmod -R 0755 /var/www/be-logic
- sudo chmod -R 0755 ~/be-logic

- changed be-logic.conf to server {

listen 80;
listen [::]:80;

server_name be-logic;

root /var/www/be-logic/html;

location / {
autoindex on;
# index index.html index.htm index.html;

location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;

- restarted nginx'
Browsing for http://be-logic or http://be-logic/index.html results in the standard Fedora test page.
This is the last line in the error.log:
"/var/www/be-logic/html/index.html" failed (13: Permission denied), client:, server: be-logic, request: "GET /index.html HTTP/1.1", host: "be-logic"

Where is the error?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 73
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready