אנדרואיד

כיצד להתקין WordPress עם Apache ב- Centos 7

Установка Apache HTTP Server в CentOS 7

Установка Apache HTTP Server в CentOS 7

תוכן עניינים:

Anonim

וורדפרס היא הפלטפורמה לבלוגים ופיתוח CMS הפופולריים ביותר ברחבי העולם, המפעילה רבע מכל אתרי האינטרנט כיום. היא מבוססת על PHP ו- MySQL ואורזת המון תכונות הניתנות להרחבה באמצעות תוספים ועיצוביות בחינם ופרמיום. וורדפרס היא הדרך הפשוטה ביותר ליצור את החנות המקוונת, האתר או הבלוג שלך.

במדריך זה נסביר כיצד להתקין וורדפרס ב- CentOS 7. בעת כתיבת מאמר זה, הגרסה האחרונה של וורדפרס היא גרסה 5.0.3.

אנו נשתמש בערימת LAMP עם Apache כשרת אינטרנט, אישור SSL, PHP 7.2 האחרון ו- MySQL / MariaDB כשרת מסד נתונים.

תנאים מוקדמים

יש לוודא כי מתקיימים התנאים המוקדמים הבאים לפני שתמשיך במדריך זה:

  • שם דומיין הצביע על כתובת ה- IP הציבורית של השרת שלך. אנו נשתמש ב- example.com התחבר כמשתמש עם הרשאות sudo. אפאצ'ס המותקן על ידי ביצוע הוראות אלה. PPP 7.2 המותקן על ידי ביצוע הוראות אלה. יש לך אישור SSL המותקן לדומיין שלך. אתה יכול ליצור תעודת SSL SSL בחינם על ידי ביצוע הוראות אלה.

יצירת מסד נתונים של MySQL

וורדפרס מאחסנת את הנתונים והתצורה שלה במסד נתונים של MySQL. אם כבר לא מותקנת MySQL או MariaDB בשרת CentOS שלך, אתה יכול להתקין על ידי ביצוע אחד המדריכים שלהלן:

  • התקן את MySQL על CentOS 7. התקן את MariaDB ב- CentOS 7.

התחבר למעטפת MySQL על ידי ביצוע הפקודה הבאה:

mysql -u root -p

מתוך מעטפת MySQL, הפעל את הצהרת SQL הבאה כדי ליצור בסיס נתונים חדש בשם wordpress :

CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

בשלב הבא, צור חשבון משתמש MySQL בשם wordpressuser והענק את ההרשאות הנחוצות למשתמש על ידי הפעלת הפקודה הבאה:

GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'change-with-strong-password';

לאחר סיום היציאה מקונסולת mysql על ידי הקלדת:

EXIT;

מוריד את וורדפרס

הפקודה הבאה תוריד את הגרסה האחרונה של וורדפרס מדף ההורדה של וורדפרס באמצעות wget ותחלץ את הארכיון לספריית שורשי המסמך של הדומיין:

wget -q -O - "http://wordpress.org/latest.tar.gz" | sudo tar -xzf - -C /var/www/html --transform s/wordpress/example.com/

הגדר את ההרשאות הנכונות כך שלשרת האינטרנט תהיה גישה מלאה לקבצי וספריות האתר:

sudo chown -R apache: /var/www/html/example.com

הגדרת תצורה של אפאצ 'י

נכון לעכשיו, עליך להתקין אפאצ'י עם אישור SSL במערכת שלך, אם לא לבדוק את התנאים המוקדמים להדרכה זו.

פתח את עורך הטקסט שלך וערוך את תצורת המארחים הווירטואליים של Apache של התחום:

sudo nano /etc/httpd/conf.d/example.com.conf

אל תשכח להחליף example.com בדומיין WordPress שלך ולהגדיר את הנתיב הנכון לקבצי אישור SSL.

/etc/httpd/conf.d/example.com.conf

ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ DirectoryIndex index.html index.php DocumentRoot /var/www/html/example.com ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem Options FollowSymLinks AllowOverride All Require all granted ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ DirectoryIndex index.html index.php DocumentRoot /var/www/html/example.com ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem Options FollowSymLinks AllowOverride All Require all granted ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ DirectoryIndex index.html index.php DocumentRoot /var/www/html/example.com ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem Options FollowSymLinks AllowOverride All Require all granted ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ DirectoryIndex index.html index.php DocumentRoot /var/www/html/example.com ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem Options FollowSymLinks AllowOverride All Require all granted ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ DirectoryIndex index.html index.php DocumentRoot /var/www/html/example.com ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem Options FollowSymLinks AllowOverride All Require all granted

התצורה תאמר לאפאצ'י להפנות מחדש ל- http ל- https ו- non-www לגרסת ה- non-www של הדומיין שלך.

הפעל מחדש את שירות Apache כדי שהשינויים ייכנסו לתוקף:

sudo systemctl restart

השלמת התקנת וורדפרס

כעת, לאחר הורדת וורדפרס והגדרת שרת Apache, תוכלו לסיים את ההתקנה דרך ממשק האינטרנט.

פתח את הדפדפן שלך, הקלד את הדומיין שלך ויופיע מסך הדומה לדברים הבאים:

מכאן אתה יכול להתחיל להתאים אישית את התקנת WordPress שלך על ידי התקנת ערכות נושא ותוספים חדשים.

סיכום

מזל טוב, התקנת בהצלחה את WordPress עם Apache בשרת CentOS 7 שלך. הצעדים הראשונים עם וורדפרס הם מקום התחלה טוב ללמוד יותר כיצד להתחיל לעבוד עם וורדפרס.

סנטוס wordpress mysql mariadb cms apache - -