我正在尝试使用Nginx设置Web应用程序,但在尝试访问时出现403错误。我已经尝试了各种不同的方法来解决这个问题,包括确保我的权限设置正确,但都没有成功。
以下是该 Web 应用程序的配置:
server {
listen 80;
server_name localhost
index index.php index.html index.htm;
root /usr/share/nginx/html/my-app/webapp;
port_in_redirect off;
# Use cached or actual file if they exists, otherwise pass request to WordPress
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
# Deny access to hidden files
location ~* /\.ht {
deny all;
access_log off;
log_not_found off;
}
# Pass PHP scripts on to PHP-FPM
location ~* \.php$ {
try_files $uri /index.php;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
我运行了
chmod -R 777 my-app
命令,以赋予所有权限。但我仍然遇到403错误。