http://ドメイン名/test
上記にアクセスして下記ファイルを参照したいです。
/home/ユーザ名/workspace/index.html
しかし、nginxの設定をどうすれてばよいかわかりません。
下記のように追記してみたのですがfile not foundと返ってきます。
参照したいindex.htmlファイルは
/home/ユーザ名/workspace/index.html
#/etc/nginx/conf.d/default.conf server { listen 80; server_name localhost; location / { root /usr/share/nginx/html; index index.html; } #下記を追加 location /test { root /home/ユーザ名/workspace; index index.html; } }
###エラー内容
2018/10/31 15:20:11 [error] 16941#0: *1 open() "/home/ユーザ名/workspace/cookie" failed (2: No such file or directory), client: 210.146.152.152, server: localhost, request: "GET /test HTTP/1.1", host: "ドメイン名"
###修正
#/etc/nginx/conf.d/default.conf server { listen 80; server_name localhost; location / { root /usr/share/nginx/html; index index.html; } #下記を修正 location /workspace { root /home/ユーザ名; index index.html; } }
上記のように修正すると
403 Forbiddenエラーがでました。
file not found (ステータス404ですね)を応答していますので、エラーログをnginxが出力しているはずです。そちらを提示いただくか、ご自身で確認のうえ設定を直してみてください。