Magento가 Nginx에서 실행되도록하기 위해 싸우고 있습니다. 저는 전문가가 아니지만 몇 주 동안 Vhost 구성으로 문제를 해결했습니다.Nginx + Magento 구성 문제. PHP 파일을 다운로드 중입니다
지금은 더 이상 무엇을 바꾸어야할지 모르겠습니다. 문제는 인덱스를 https://mailtest.unitracer.nl/에 입력하고 Magento로 이동하면 PHP 파일을 다운로드하려고 시도한다는 것입니다. 이 프로젝트가 끝나야합니다. 저는 Nginx를 구현하는 법을 배우고 자하는 회사의 인턴입니다. 아무도이 곳에서 도와 줄 수 없으므로 여기 사람들이 나를 도울 수 있기를 바랍니다! nginx에서 두 개의 별도 vhost 파일을 만듭니다. 하나는 내 인덱스 용이고 다른 하나는 백업을 작성하는 백업 폴더이며 다운로드 할 수 있습니다. 다른 하나는 순전히 Magento 용입니다.
나는 여기에 내 nginx.conf 파일을 포함하여 둘 다 게시 할 것입니다.
server {
listen 80;
listen 443 default ssl;
server_name mailtest.unitracer.nl www.mailtest.unitracer.nl;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
access_log /var/log/nginx/magento.access.log;
error_log /var/log/nginx/magento.error.log;
root /var/www/magento;
location/{
index index.php;
try_files $uri $uri/ @handler;
}
#deny deze mappen, niemand heeft er iets te zoeken
location /app/ { deny all; }
location /includes/ { deny all; }
location /lib/ { deny all; }
location /media/downloadable/ { deny all; }
location /pkginfo/ { deny all; }
location /report/config.xml { deny all; }
location /var/ { deny all; }
#in /var/export map moet ik user credentials instellen om /var/export te benaderen
#in htpasswd
location /var/export/ {
auth_basic "Restricted";
auth_basic_user_file htpasswd;
autoindex on;
}
#Deny access hidden files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location @handler {
rewrite//index.php;
}
location ~ .php/ {
rewrite ^(.*.php)/ $1 last;
}
location ~ .php$ {
if (!-e $request_filename) {
rewrite//index.php last;
}
expires 30d;
fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_param HTTPS $fastcgi_https;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE default;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;
}
}
여기
, 내가이 일을해야하는 경우에도 반드시 내 다른 가상 호스트 아니에요됩니다 : 여기
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
#default_type text/html;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
내 젠토 가상 호스트 파일입니다 : 여기
내 nginx.conf 파일입니다 그러나 나의 색인은 그것없이 보여주지 않을 것이다.
server {
listen 80;
listen 443;
root /var/www/;
index index.php;
autoindex on;
server_name mailtest.unitracer.nl;
#SSL Directives
ssl on;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
ssl_prefer_server_ciphers on;
#Location for index
# location ^(.+~\.php)(/.*)$ {
# fastcgi_split_path_info ^(.+~\.php)(/.+)$;
# fastcgi_pass unix:/var/run/php5-fpm.sock;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# include fastcgi_params;
# try_files $uri $uri/ /index.php =404;
# }
#Mijn back-up server block
location /backups {
auth_basic "Restricted";
auth_basic_user_file /var/www/backups/.htpasswd;
try_files $uri $uri/ =404;
}
}
이전에 phpmyadmin에서 작동했기 때문에 PHP 파일이 올바른 PHP FPM 소켓으로 전달되었음을 알고 있습니다.
누군가가이 문제의 구성을 도와 줄 수 있다면 좋겠지 만 Nginx에서 호스트하는 방법을 이해할 수 있도록 magento가 필요합니다.
친절한 인사,
스테판
내가 실수가 생각