NGINX Web Sitesi ServBay'e Nasıl Taşınır?
ServBay'in birlikte gelen Web sunucusu Caddy'dir. Basit yapılandırması ve otomatik HTTPS özelliği ile bilinir. ServBay'de Rewrite kuralları varsayılan olarak yapılandırılmıştır, kullanıcıların genellikle ek Rewrite kuralları yapılandırmasına gerek yoktur. Bu makale, NGINX web sitesinin ServBay'e nasıl taşınacağını ayrıntılı olarak anlatacak ve örnek olarak Laravel ve WordPress kullanılacaktır.
Genel Bakış
Web sitesi taşımak, mevcut yapılandırma ve dosyaların yeni sunucu ortamına aktarılmasını içerir. ServBay, Web sunucusu olarak Caddy kullanır ve çoğu PHP çerçevesi ve CMS sistemi için ServBay kutudan çıktığı gibi çalışır, ek Rewrite kuralları yapılandırmasına gerek yoktur.
Taşıma Öncesi Hazırlık
Taşıma işlemine başlamadan önce, tüm web sitesi dosyalarınızı ve veritabanınızı yedeklediğinizden emin olun. Taşıma sırasında çeşitli sorunlarla karşılaşabileceğiniz için yedekleme yapmak çok önemlidir.
Laravel Web Sitesini Taşıma
NGINX Yapılandırması
Aşağıda, bir Laravel web sitesi için tipik bir NGINX yapılandırma dosyası verilmiştir:
server {
listen 80;
server_name laravel.demo;
root /Applications/ServBay/www/laravel/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/Applications/ServBay/tmp/php-cgi.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Caddy Yapılandırması
Önemli Hatırlatma
ServBay'de, Rewrite kuralları ve PHP işleme kuralları varsayılan olarak yapılandırılmıştır, kullanıcıların manuel olarak yapılandırma dosyası yazması gerekmez.
Aşağıda, karşılaştırma ve kavrama amacıyla teorik bir Caddy yapılandırma örneği verilmiştir:
laravel.demo {
root * /Applications/ServBay/www/laravel/public
php_fastcgi unix//Applications/ServBay/tmp/php-cgi.sock
file_server
@notStatic {
not {
file {
try_files {path} {path}/ /index.php?{query}
}
}
}
rewrite @notStatic /index.php
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
WordPress Web Sitesini Taşıma
NGINX Yapılandırması
Aşağıda, bir WordPress web sitesi için tipik bir NGINX yapılandırma dosyası verilmiştir:
server {
listen 80;
server_name wordpress.demo;
root /Applications/ServBay/www/wordpress;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/Applications/ServBay/tmp/php-cgi.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Caddy Yapılandırması
Önemli Hatırlatma
ServBay'de, Rewrite kuralları ve PHP işleme kuralları varsayılan olarak yapılandırılmıştır, kullanıcıların manuel olarak yapılandırma dosyası yazması gerekmez.
Aşağıda, karşılaştırma ve kavrama amacıyla teorik bir Caddy yapılandırma örneği verilmiştir:
wordpress.demo {
root * /Applications/ServBay/www/wordpress
php_fastcgi unix//Applications/ServBay/tmp/php-cgi.sock
file_server
@notStatic {
not {
file {
try_files {path} {path}/ /index.php?{query}
}
}
}
rewrite @notStatic /index.php
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Özet
NGINX web sitesini ServBay'in Caddy sunucusuna taşımak çok basittir, herhangi bir yapılandırma değişikliği yapmanıza gerek yoktur, sadece ServBay'de web sitesini eklemeniz yeterlidir. Caddy'nin yapılandırma dosyası sözdizimi basit ve okunabilirdir, ServBay'de Rewrite kuralları ve PHP işleme varsayılan olarak yapılandırılmıştır, kullanıcıların genellikle ek yapılandırma yapmasına gerek yoktur. Bu makalede, Laravel ve WordPress web sitelerinin ServBay'e nasıl taşınacağını öğrenebilirsiniz.