Хорошо .. У меня проблема, когда каждая страница загружает одну и ту же страницу в этой конфигурации nginx. Загружаемая страница выглядит как index.php
Не совсем уверен, что случилось? Он должен обслуживать ресурсы с диска и перенаправлять запросы php на index.php
Мои хосты nginx:
server {
listen 1.2.3.4:443 ssl;
server_name xxxxxxxxxx;
server_name xxxxxx;
server_name xxxxxxxx;
ssl_certificate /usr/local/psa/var/certificates/xxxx;
ssl_certificate_key /usr/local/psa/var/certificates/xxxx;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
client_max_body_size 128m;
add_header Bryan was_here;
root /var/www/vhosts/xxxx/httpdocs/;
disable_symlinks off;
location / {
try_files $uri $uri/ /index.php?$args;
access_log off;
}
#location = / {
#index index.php;
#}
# set a nice expire for assets
location ~* "^.+\.(jpe?g|gif|css|png|js|ico|pdf|zip|tar|t?gz|mp3|wav|swf)$" {
expires max;
add_header Cache-Control public;
}
# the downloader has its own index.php that needs to be used
location ~* ^(/downloader|/js|/404|/report)(.*) {
proxy_pass http://1.2.3.4:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
}
location ~* \.php {
proxy_pass http://1.2.3.4:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
}
location /internal-nginx-static-location/ {
alias /var/www/vhosts/xxxx/httpdocs/;
access_log /var/www/vhosts/xxxx/statistics/logs/proxy_access_ssl_log;
add_header X-Powered-By PleskLin;
internal;
}
}
server {
listen 1.2.3.4:443 ssl;
server_name webmail.xxxx;
ssl_certificate /usr/local/psa/var/certificates/xxxx;
ssl_certificate_key /usr/local/psa/var/certificates/xxxx;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
client_max_body_size 128m;
location / { # IPv6 isn't supported in proxy_pass yet.
proxy_pass https://1.2.3.4:7081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log /var/www/vhosts/xxxx/statistics/logs/webmail_access_ssl_log;
}
}
server {
listen 1.2.3.4:80;
server_name xxxx;
server_name xxxx;
server_name xxxx;
client_max_body_size 128m;
root /var/www/vhosts/xxxx/httpdocs/;
disable_symlinks off;
location / {
try_files $uri $uri/ /index.php?$args;
access_log off;
#proxy_pass https://1.2.3.4:7081;
#proxy_set_header Host $host;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#location = / {
#index index.php;
#}
# set a nice expire for assets
location ~* "^.+\.(jpe?g|gif|css|png|js|ico|pdf|zip|tar|t?gz|mp3|wav|swf)$" {
expires max;
add_header Cache-Control public;
}
# the downloader has its own index.php that needs to be used
location ~* ^(/downloader|/js|/404|/report)(.*) {
proxy_pass http://1.2.3.4:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
}
location ~* \.php {
proxy_pass http://1.2.3.4:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
}
location /internal-nginx-static-location/ {
alias /var/www/vhosts/xxxx/httpdocs/;
access_log /var/www/vhosts/xxxx/statistics/logs/proxy_access_log;
internal;
}
}
server {
listen 1.2.3.4:80;
server_name webmail.xxxx;
client_max_body_size 128m;
location / { # IPv6 isn't supported in proxy_pass yet.
proxy_pass http://1.2.3.4:7080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log /var/www/vhosts/xxxx/statistics/logs/webmail_access_log;
}
}
/etc/nginx/nginx.conf:
user nginx;
worker_processes 1;
#error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
#pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log /var/log/nginx/access.log main;
sendfile on;
#autoindex off;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#tcp_nodelay on;
#gzip on;
#gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
server_tokens off;
include /etc/nginx/conf.d/*.conf;
}
Я предполагаю, но ваши аргументы try_files мне кажутся неправильными.
Попробуйте, может быть, лучше с
/index.php?q=$uri&$args;
Более того, можно ли получить error.log об этом виртуальном хосте?