GNU/Linux >> Linux の 問題 >  >> Debian

Debian8にNginxを使用してZenCartをインストールする方法

このステップバイステップのチュートリアルでは、 Debian8VPSにNginxを使用してZenCartをインストールする方法を紹介します。 。 Zen Cartは、オープンソースのPHPベースのショッピングカートソフトウェアです。このチュートリアルはDebian8VPS用にテストおよび作成されていますが、DebianベースのLinuxディストリビューションで動作するはずです。

次のコマンドを実行して、パッケージリストとOSパッケージが最新であることを確認します。

sudo apt-get update
sudo apt-get upgrade

Apache2サービスを停止して削除します:

sudo service apache2 stop
sudo apt-get remove apache2
sudo apt-get autoremove

仮想サーバーにNginxをインストールします:

sudo apt-get update
sudo apt-get install nginx

起動時に開始するようにnginxを構成します:

sudo update-rc.d -f nginx defaults

Zen Cartに必要なPHPおよびPHPモジュールをインストールします:

sudo apt-get install php5 php5-cli php5-fpm php5-mysql php5-gd php5-mcrypt 
sudo php5enmod mcrypt

https://www.zen-cart.com/getitで最新バージョンのZenCartをダウンロードし、サーバーの/optディレクトリにアップロードします。

cd /opt/
wget http://downloads.sourceforge.net/project/zencart/CURRENT%20-%20Zen%20Cart%201.5.x%20Series/zen-cart-v1.5.4-12302014.zip
unzip zen-cart-v1.5.4-12302014.zip
mv zen-cart-v1.5.4-12302014 /var/www/zen-cart/

ここでeコマースWebサイトのSSL証明書を注文します。 SSL証明書とその秘密鍵をそれぞれ「file.crt」と「private.key」という名前のファイルに保存し、それらを/ etc / nginxディレクトリにアップロードします。
デフォルトのNginxサーバーブロックを削除し、新しいNginx構成ファイルを作成しますドメイン名に次の仮想ブロックを追加します:

rm /etc/nginx/sites-enabled/default
vi /etc/nginx/sites-available/your-domain.com.conf

次の行を追加します。
server{
listen 80;
#SSL証明書がある場合は、以下の3行のコメントを解除します。
#listen 443 ssl;
#ssl_certificate /etc/nginx/file.crt;
#ssl_certificate_key /etc/nginx/private.key;

server_name your-domain.com www.your-domain.com;

ルート/var/www/your-domain.com;

index index.html index.htm index.php index.cgi index.pl index.xhtml;

error_page 400 /error/400.html;
error_page 401 /error/401.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 405 /error/405.html;
error_page 500 /error/500.html;
error_page 502 /error/502.html;
error_page 503 /error/503.html;

access_log /var/log/nginx/your-domain.com-access.log;
error_log /var/log/nginx/your-domain.com-error.log;
charset en_us.UTF-8;

## .htaccessおよびその他の隠しファイルを無効にします
場所〜/\。 {
すべて拒否;
access_log off;
log_not_found off;
}

location =/favicon.ico {
log_not_found off;
access_log off;
}

location =/robots.txt {
all allow;
log_not_found off;
access_log off;
}

location〜 \ .php $ {
try_files $ uri =404;
include / etc / nginx / fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
fastcgi_intercept_errors on;
}

#静的コンテンツの最大有効期限
場所〜*^。+\。(jpg | jpeg | gif)$ {
access_log off;
30日有効;
}

#アクセスできない場所
場所〜/includes/.*\.php$ {return 403; }
location〜 / backups {return 403; }
location〜 / download {return 403; }
location〜 / email {return 403; }
location〜 / media {return 403; }
location〜 / logs {return 403; }

#場所のみの画像を
場所から提供する必要があります〜/ sqld {try_files none.txt @imagesonly; location〜 \ .php $ {return 403; }}
location〜 / images {try_files none.txt @imagesonly; location〜 \ .php $ {return 403; }}
location〜 / editors {try_files none.txt @imagesonly; location〜 \ .php $ {return 403; }}

location @imagesonly {
types {
image / gif gif;
image / jpeg jpeg jpg;
image / png png;
}
default_type application /オクテットストリーム;
}

location / shop /
{
location〜-p-(? [0-9] +)\。html $ {rewrite ^ /shop/index.php?main_page=product_info&products_id=$id; }
location〜 -c-(?。*)。html $ {rewrite ^ /shop/index.php?main_page=index&cPath=$id; }
location〜 -m-(? [0-9] +)。html $ {rewrite ^ /shop/index.php?main_page=index&manufacturers_id=$id; }
location〜-pi-(? [0-9] +)。html $ {rewrite ^ /shop/index.php?main_page=popup_image&pID=$id; }
location〜 -pr-(? [0-9] +)。html $ {rewrite ^ /shop/index.php?main_page=product_reviews&products_id=$id; }
location〜-pri-(? [0-9] +)。html $ {rewrite ^ /shop/index.php?main_page=product_reviews_info&products_id=$id; }
location〜 -ezp-(? [0-9] +)。html $ {rewrite ^ /shop/index.php?main_page=page&id=$id; }
}

location〜 \ .php $ {
try_files $ uri =404;
include / etc / nginx / fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
fastcgi_intercept_errors on;
}
}
}

your-domain.comを実際のドメイン名に置き換えることを忘れないでください。

新しいNginx構成ファイルを有効にします:

ln -sf /etc/nginx/sites-available/your-domain.com.conf /etc/nginx/sites-enabled/

/etc/php5/fpm/pool.d/www.confファイルを開き、「listen」変数を次のように変更します。

listen = /var/run/php5-fpm.sock

listen = 127.0.0.1:9000;

nginx構成をテストします:

# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

次に、php5-fpmおよびNginxサービスを再起動して、変更を有効にします。

sudo service php5-fpm restart
sudo service nginx restart

適切な権限を設定します:

sudo chown www-data:www-data -R /var/www/your-domain.com/

新しいMySQLデータベースを作成します:

mysql -u root -p
mysql> create database zencartdb;
mysql> GRANT ALL PRIVILEGES ON zencartdb.* TO 'zencart'@'localhost' IDENTIFIED BY 'Y0UR-PASSW0RD';
mysql> flush privileges;
mysql> quit
>

Webブラウザを使用してhttp://your-domain.com/zc_install/index.phpを開き、簡単な手順に従います。ライセンス条項への同意を確認し、MySQLデータベースのユーザー名、パスワード、データベース名を入力し、[SSLを有効にする]を選択します。 [管理エリアでSSLを有効にする]、[システム設定の保存]をクリックし、ストア情報を入力し、[ストア設定の保存]をクリックして、管理者のユーザー名とパスワードを入力します。

/ admin /include/および/includes/ディレクトリにある「configure.php」ファイルの権限を読み取り専用モードにリセットします:

chmod 440 /var/www/your-domain.com/admin/includes/configure.php

chmod 440 /var/www/your-domain.com/includes/configure.php

/ zc_installディレクトリを削除します:

rm -rf /var/www/your-domain.com/zc_install

また、「admin」ディレクトリの名前を、不正アクセスのためにWebサイトを調査している誰かによって「推測」される可能性が低い名前に変更します。


以上です。 Zan Cartのインストールが完了しました。
もちろん、Linux VPSホスティングサービスのいずれかを使用している場合は、これを行う必要はありません。その場合は、専門のLinux管理者にインストールを依頼するだけです。 Linuxを搭載したZenカート あなたのために。 24時間年中無休でご利用いただけます。リクエストはすぐに処理されます。

PS。 この投稿が気に入った場合は、左側のボタンを使用してソーシャルネットワーク上の友達と共有するか、下に返信を残してください。ありがとう。


Debian
  1. Nginxを使用してDebianにGhostをインストールする方法

  2. Nginxを使用してDebianWheezyにDokuWikiをインストールする方法

  3. Debian10にNginxを使用してWordPressをインストールする方法

  1. Debian9にNginxでPhorumをインストールする方法

  2. Debian11にNginxを使用してHTTPGitサーバーをインストールする方法

  3. Debian8VPSにNginxを使用してFuelPHPをインストールする方法

  1. ZenCartをDebian9にインストールする方法

  2. Debian9にNginxを使用してWonderCMSをインストールする方法

  3. Debian11にNginxを使用してWonderCMSをインストールする方法