W
W
Willli2014-12-22 16:55:52
Nginx
Willli, 2014-12-22 16:55:52

What to prescribe ssi nginx?

Good day!
(I'm a krivoruch)
Installed nginx (mac os), uploaded the index.html file, everything works super-duper. Relatively recently, I created a page about ssi, divided it into blocks, fill in index.shtml and gives a
403 forbidden error.
nginx.conf

#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
ssi on;
listen 8080;
server_namelocalhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root share/nginx/html;
index index.html index.htm index.shtml;
}
#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 share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root share/nginx/html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# 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 a mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listensomename:8080;
# server_name somename alias another.alias;
# location / {
# root share/nginx/html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root share/nginx/html;
# index index.html index.htm;
#}
#}
}

Please tell me what's wrong? and what needs to be done to display the index.shtml file?
(*I tried googling).

Answer the question

In order to leave comments, you need to log in

5 answer(s)
W
Willli, 2014-12-23
@Willli

Thank you guys so much it worked!
Did sudo chmod -R u=rwX,g=rX,o=rX /opt/local/share/nginx/html/
and rebooted!!!
Eeeee...!

E
Ergil Osin, 2014-12-22
@Ernillew

Did you look at the rights to the file itself? Does nginx have permission to read it?

V
Vitaly Borovikov, 2014-12-22
@CrusaderX

root share/nginx/html; -> root /share/nginx/html;
Enabled ssi in location /, everything works for me.
Also check your permissions.

A
Alexey Kureev, 2014-12-22
@xamd

Log messages
as well as
indicate that there is no access to the /opt/local/share/nginx/html/ folder, you need read permissions.
This should fix the issue
sudo chmod -R 755 /opt/local/share/nginx/html/

J
J_o_k_e_R, 2014-12-23
@J_o_k_e_R

0) Aleksey Kureev’s advice
definitely broke everything for you, since the rights to the folder should be 755. And if it’s easier, then do it: sudo chmod -R u=rwX,g=rX,o=rX /opt/local/share/nginx/ html/ - this will set the right permissions for sure. 1) reduce the config to the required minimum:

worker_processes 1;
events {
worker_connections 1024;
}
error_log logs/error.log notice;
http {
include mime.types;
default_type application/octet-stream;
server {
ssi on;
listen 8080;
server_namelocalhost;
access_log logs/access.log main;
location / {
root share/nginx/html;
index index.html index.htm index.shtml;
}
}
}

2) Write the full paths to the logs and root in the config.
3) Restart nginx.
If the error persists, then
4) Create a text file test.txt with the content "test" in the directory where root points to.
5) Try to open the links localhost:8080/index.shtml , localhost:8080/test.txt
6) Post the logs (item 2) from the last restart (item 3) to their end. No one is interested in reading a sheet for several days. It will be no more than a dozen lines for each log file.
7) Post the output of nginx -V.
8) Post the output of ls -ld /opt/local/share/nginx; ls -lR /opt/local/share/nginx/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question