Answer the question
In order to leave comments, you need to log in
How to set up NGINX to redirect to the mobile version?
With nginx, not even on "you", practically unfamiliar.
Actually found the solution on the Internet. but I do not quite understand how to connect it with what I have. I will be glad to hints, solutions and links to tutorials too.
Here is my code (not mine, but the isp socket gene):
#user 'wokster' virtual host 'мойдомен.ru' configuration file
server {
server_name мойдомен.ru www.мойдомен.ru;
charset UTF-8;
disable_symlinks if_not_owner from=$root_path;
index index.html index.php;
root $root_path;
set $root_path пути;
access_log пути;
error_log пути
include пути*.conf;
location / {
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
try_files $uri $uri/ @fallback;
}
location / {
try_files /does_not_exists @fallback;
}
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @fallback;
}
}
location @fallback {
proxy_pass http://127.0.0.1:8080;
proxy_redirect http://127.0.0.1:8080 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
access_log off ;
}
ssi on;
listen ipмоего сервера:80;
}
server{ < … > if ( $http_user_agent ~* (windows\smobile|windows\sce|iphone|ipod|midp|symbian|series\s60|s60|nokia|аndroid| blackberry) ){ rewrite ^/(.*) http://m.site.ru/$1 permanent; } location / { < … > } }
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question