小编dgh*_*dgh的帖子

nginx 403 Forbidden Error 在用户主目录中托管

我已经在本地机器上的 Ubuntu 12.04 上安装了 nginx 1.1.19,并保留了默认值,/etc/nginx/nginx.conf除了更改用户指令。

/etc/nginx/nginx.conf

user nginx www-data;
worker_processes 4;
pid /var/run/nginx.pid;
...
Run Code Online (Sandbox Code Playgroud)

我想在我的用户目录中使用 web 根目录创建一个简单的静态站点(假设我的用户名是“ubuntu”)。这是我的测试站点的配置。

/etc/nginx/sites-available/test-site

server {
    #listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6

    root /home;
    index index.html index.htm;

    # Make site accessible from http://localhost/
    server_name localhost;

    location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to index.html
    try_files $uri $uri/ /index.html; …
Run Code Online (Sandbox Code Playgroud)

ubuntu permissions nginx ubuntu-12.04

9
推荐指数
1
解决办法
4万
查看次数

标签 统计

nginx ×1

permissions ×1

ubuntu ×1

ubuntu-12.04 ×1