gpt4 book ai didi

magento - 如何在 ubuntu localhost 上使用 magento 配置 nginx

转载 作者:行者123 更新时间:2023-12-04 18:52:17 26 4
gpt4 key购买 nike

我需要在 nginx 服务器上的 ubuntu 上安装 magento 1.8 和 1.9。
我创建了配置,但工作不正常。

我需要为 magento 1.8、magento 1.9 创建一个全局配置文件

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /usr/share/nginx/html;
index index.php index.html index.htm;

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

location / {

try_files $uri $uri/ =404;
}

location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}

#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location ~ \.php$ {

# With php5-fpm:
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}

最佳答案

您在评论中声明您收到 403 禁止消息。有很多事情可能会导致这种情况。通过检查默认保存在 /var/log/nginx/*.log 中的 nginx 错误日志,您将找到有关此错误的更多信息。

我强烈建议您检查错误日志以获取更多信息,因为这将加快解决问题的过程。

1.网络根目录不正确

一个明显的,但只要确保你有正确的网络根集
$ ls /usr/share/nginx/html
2.目录和文件权限

检查您的 Web 用户(通常是 Ubuntu/Debian 上的 www-data)是否有权访问 Web 目录中的文件作为目录本身。通过在终端上运行检查权限:
$ ls -l /usr/share/nginx/html
确保文件具有正确的权限集,例如,没有设置为 root 所有权。

Magento 有关于重置 Magento 安装文件权限的说明 here .总之,在终端上运行以下命令:

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod 550 pear
chmod 550 mage #for magento 1.5+

关于magento - 如何在 ubuntu localhost 上使用 magento 配置 nginx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27463628/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com