Portál AbcLinuxu, 12. prosince 2025 10:08
systemctl status apache2
a příkazsystemctl status nginx
a běží tam nginx, co prosím dál? Děkuji
# MOJE
location ~ /moje {
alias /var/www/html/moje/;
index index.php;
try_files $uri $uri/ /moje/index.php$is_args$args;
location ~ \.php {
faststcgi_param SCRIPT_FILENAME /var/www/html/moje/index.php;
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_index index.php;
}
}
Po uprave konfigurace je potreba restartovat nginx "systemctl reload nginx".Kdyz se neco nepovede uvidis to v "/var/log/nginx/error.log". Pokud se to povede na adrese mojestranky.cz/moje uvidis svuj obsah.
server {
listen 443 ssl;
listen [::]:443 ssl;
...
# HSTS
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
...
ssl_certificate /etc/letsencrypt/live/xxx/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/xxx/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
...
Pokud uz na serveru jine DNS/HTTPS mas je potreba si udelat vlastni "server" sekci.
RewriteEngine On
Options -Indexes
Options +FollowSymLinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
Jde to prosím nějak zapsat pro nginx?
return 301 $scheme://$server_name/index.php?url=$request_uri;Nebo:
try_files $uri $uri/ /moje/index.php?url=$uri;
return 301 $scheme://$server_name/moje/index.php?url=$request_uri;
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.example.com;
root /var/www/html;
index index.php index.html;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.example.com/privkey.pem;
include /etc/nginx/templates/php-catchall.tmpl;
return 301 $scheme://$server_name/index.php?url=$request_uri;
}
2023/01/10 15:20:45 [error] 31159#31159: *33263 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: xx.xxx.xx.xxx, server: example.com, request: "GET / HTTP/2.0", upstream: "fastcgi://127.0.0.1:9999", host: "www.example.com"
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.