Telegram- 👇 😉
-
. WIKIMERIONET
Merion Mertics , ,

CRM

4

Nginx - - Linux -. Nginx - -. - HTTP HTTPS-.

Nginx redirect

, HTTP HTTPS Nginx.


  • Linux Nginx
  • sudo
  • - (, , -)
  • / (Ctrl-Alt-T Ctrl-Alt-F2)

HTTP HTTPS

HTTP HTTPS Nginx.

/etc/nginx/sites-available. , : /etc/nginx/nginx.conf, /usr/local/nginx/conf /usr/local/etc/nginx.

Nginx, :

sudo nano /etc/nginx/sites-available/server.conf

.

, . , . Nginx :

sudo service nginx restart

HTTP- HTTPS

Nginx , :

server {
    listen 80 default_server;
    server_name _;
    return 301 https://$host$request_uri;
}

:

  • Listen 80: HTTP- 80
  • Server_name _ ;:
  • Return 301: ,
  • https://$host$request_uri: HTTPS ,

HTTP HTTPS.

: , 80. - Nginx. .

, HTTPS. :

server {
    listen 80 default_server;
    server_name my_app.com;
    return 301 https://my_app.com$request_uri;
}

my_app.com , . , . .

SSL-

, , SSL- 443:

server {
    listen 443 ssl default_server;
    server_name my_app.com;
}

server {
    listen 443 ssl;
    server_name my_website.com;
}

-, my_app.com my_website.com, SSL-. , .

rewrite 301 () 302 () :

	Location /index.html {
       rewrite ^/oldURL$ https://www.your_domain.com/newURL redirect;
}

index.html, .

, rewrite 301 302.

Nginx

, ( .org .com). Nginx .

server {
    listen 80;
    listen 443 ssl;
    server_name www.old_company.com;
    return 301 $scheme://www.new_company.com$request_uri;
}

return rewrite.

www www

:

server {
    server_name www.new_company.com;
    return 301 $scheme://new_company.com$request_uri;
}

HTTP- HTTPS:

  • .
  • SEO-, .
  • .
  • , .

, HTTP HTTPS Nginx. , SSL. , .