wmaraci reklam

Nginx Konfigurasyon

4 Mesajlar 536 Okunma
pst.net
wmaraci reklam

sworks sworks WordPress Kullanıcı
  • Üyelik 28.02.2018
  • Yaş/Cinsiyet 28 / E
  • Meslek Freelancer
  • Konum Diğer
  • Ad Soyad A** K**
  • Mesajlar 3292
  • Beğeniler 1797 / 1799
  • Ticaret 20, (%100)
Merhabalar,

Ubuntu 18.04 üzerine WordPress - Nginx kurdum.

server {
listen 80;
root /var/www/html;
index index.php index.html index.htm;
server_name example.comwww.example.com ;
client_max_body_size 0;

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}

location ~* \.php$ {
if ($uri !~ "^/uploads/") {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}

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

location ~* .(css|gif|ico|jpeg|jpg|js|png)$ {
expires 30d;
log_not_found off;
}
}


Sorunum şu, yukarıdaki benim default dediğimiz kurulumda eklediğim nginx konfigurasyonu. Buna ek olarak manuel bir şekilde Cloudflare 15 yıllık SSL sertifikasını sunucuya yükledim.

Bunu yukarıdaki konfigürasyona nasıl tanımlamam gerekiyor? Bir türlü güncel ve düzgün bir kaynak bulamadım.

Ayrıca DigitalOcean ipv6 desteğini de açık yaptım. ipv6 için bir şey eklemeli miyim?
 

 

wmaraci
reklam

MuhammedArslan MuhammedArslan Msa Web Tasarım Kullanıcı
  • Üyelik 19.02.2017
  • Yaş/Cinsiyet 24 / E
  • Meslek Web Developer
  • Konum Bursa
  • Ad Soyad M** A**
  • Mesajlar 933
  • Beğeniler 136 / 276
  • Ticaret 11, (%100)
Şu şekilde ekleme yapmayı dener misin.


listen 443 ssl;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;


Tabiki sertifika yolunu kendine göre düzenlersin :)
sworks

kişi bu mesajı beğendi.

sworks sworks WordPress Kullanıcı
  • Üyelik 28.02.2018
  • Yaş/Cinsiyet 28 / E
  • Meslek Freelancer
  • Konum Diğer
  • Ad Soyad A** K**
  • Mesajlar 3292
  • Beğeniler 1797 / 1799
  • Ticaret 20, (%100)
MuhammedArslan öncelikle yardımınız için teşekkürler.
Peki 301 yönlendirmesi, ipv6 desteği sağlamak için ne yapmak gerekiyor acaba?

Sizin verdiğiniz koddan da yola çıkarak örnek bir konfigürasyon dosyası oluşturdum. Her şey sorunsuz çalışıyor fakat bazı kodlar işlev görmüyor.

server {
listen 443;

charset UTF-8;

ssl on;
ssl_certificate /etc/cloudflare-ssl/example-com.pem;
ssl_certificate_key /etc/cloudflare-ssl/secretkey-example-com.key;
include /etc/cloudflare-ssl/options-ssl-nginx.conf;
ssl_client_certificate /etc/nginx/cloudflare.crt;
ssl_verify_client on;

root /var/www/html;
index index.php index.html index.htm;
server_name example.netwww.example.net ;
client_max_body_size 0;

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}

location ~* \.php$ {
if ($uri !~ "^/uploads/") {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}

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

# REMOVE THIS LATER
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";

# X-XSS Protection
add_header X-XSS-Protection "1; mode=block";

# Deny access to uploads that are not images, videos, music, etc.
location ~* ^/wp-content/uploads/.*.(html|htm|shtml|php|js|swf)$ {
deny all;
}
}

server {
if ($host =www.example.net ) {
return 301 https://example.net $request_uri;
} # managed by Certbot


if ($host = example.net) {
return 301 https://example.net $request_uri;
}

listen 80;
server_name example.netwww.example.net ;
return 404;

}


Örneğin alttaki kod sitemi açana kadar noindex yapmak için eklediğim bir kod.
# REMOVE THIS LATER
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";


Bu kod mesela çalışmıyor. HTTP header'i kontrol ettiğimde noindex yazısı yok ama farklı bir kod çalışıyor. Bir türlü karmaşayı çözemedim :)
 

 

Mrtcn Mrtcn PrismaCSI Kullanıcı
  • Üyelik 06.09.2013
  • Yaş/Cinsiyet 31 / E
  • Meslek Cyber Sec & Project Manager
  • Konum Ankara
  • Ad Soyad M** G**
  • Mesajlar 3356
  • Beğeniler 481 / 1986
  • Ticaret 10, (%100)
Örnek olması için;

nginx.conf - https://pastebin.com/8Ey7DHVm
headers - https://pastebin.com/LWZZEAD3
site.conf - https://pastebin.com/hY4Zj05j
sworks

kişi bu mesajı beğendi.

wmaraci
Mersin evden eve nakliyat
wmaraci
Konuyu toplam 1 kişi okuyor. (0 kullanıcı ve 1 misafir)
Site Ayarları
  • Tema Seçeneği
  • Site Sesleri
  • Bildirimler
  • Özel Mesaj Al