I just installed nginx and php fastcgi about an hour ago, and after reading examples of a quick starting configuration, and the nginx documentation etc, I just cant get it to work.
No matter what I change or try, I always only get the "Welcome to Nginx!" screen on "localhost/..." - I cant even call a simple index.html
My config:
(the stuff in the comments is what I tried out)
// default nginx stuff (unchanged) server { #listen 80 default_server; #listen 80 default; listen 80; #server_name localhost; #server_name _; #access_log /var/log/nginx/board.access_log; #error_log /var/log/nginx/board.error_log; #root /var/www/board; #root /var/www/board/public/; root /var/www/board/public; #index index.html; index index.html index.htm index.php; }
If I understand it right, this should be the easiest setup, right? just define listen 80;
and index index.html;
but I just cant get it to work
The file /var/www/board/public/index.html exists and has content
Before I waste 2 more hours trying out something, can someone of you give it a quick watch and tell me what I'm doing wrong? Thanks.
Through a simple command you can verify the status of the Nginx configuration file: $ sudo systemctl config nginx The output will show if the configuration file is correct or, if it is not, it will show the file and the line where the problem is.
By default, the configuration file is named nginx. conf and placed in the directory /usr/local/nginx/conf , /etc/nginx , or /usr/local/etc/nginx .
To test the Nginx configuration, run the following command. You can test the Nginx configuration, dump it and exit using the -T flag as shown. nginx: the configuration file /etc/nginx/nginx. conf syntax is ok nginx: configuration file /etc/nginx/nginx.
Fundamentally you hadn't declare location which is what nginx uses to bind URL with resources.
server { listen 80; server_name localhost; access_log logs/localhost.access.log main; location / { root /var/www/board/public; index index.html index.htm index.php; } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With