0

Понадобилось перенести web приложение на сервер( на сервере стоит debian ), возникли проблемы при настройке виртуального хоста на nginx

Вывод ls -l для директорий /etc/nginx/site-*:

/etc/nginx/sites-available:
итого 8
-rw-r--r-- 1 root root 2662 июл 23 18:17 basism.zahp
-rw-r--r-- 1 root root 2977 июл 23 18:26 default

/etc/nginx/sites-enabled:
итого 0
lrwxrwxrwx 1 root root 38 июл 23 18:02 basism.zahp -> /etc/nginx/sites-available/basism.zahp
lrwxrwxrwx 1 root root 34 июл 23 15:18 default -> /etc/nginx/sites-available/default

Файл basism.zahp :

server {
        listen 80;
        listen [::]:80;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/basism.zahp;

        #index index.html index.htm index.php;
        index index.html index.htm;

        server_name basism.zahp www.basism.zahp;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
                #proxy_send_timeout 65s;        #enable for old
                #proxy_read_timeout 65s;        #enable for old
        }

        # pass PHP scripts to FastCGI server
        #
        #location ~ \.php$ {    #php enable for old
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php-fpm (or other unix sockets):
        #       fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       # fastcgi_pass 127.0.0.1:9000;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}

        location /login {
                proxy_pass http://127.0.0.1:1323;
        }
        location /logout {
                proxy_pass http://127.0.0.1:1323;
        }

}

Вывод для ls-l /var/www/basism.zahp/:

-rw-r--r-- 1 root root  1788 июл 23 18:07 asset-manifest.json
-rw-r--r-- 1 root root   636 июл 23 18:07 dialog-polyfill.css
-rw-r--r-- 1 root root 25289 июл 23 18:07 dialog-polyfill.js
-rw-r--r-- 1 root root 96758 июл 23 18:07 favicon.ico
-rw-r--r-- 1 root root   660 июл 23 18:07 index.html
-rw-r--r-- 1 root root   293 июл 23 18:07 manifest.json
-rw-r--r-- 1 root root  4750 июл 23 18:07 service-worker.js
drwxr-xr-x 5 root root  4096 июл 23 18:07 static

При вводе в браузере http://basism.zahp/, нет доступа к сайту

7
  • Во-первых, у basism.zahp DNS not resolved. До вашего сервера даже ничего не доходит. Во-вторых, когда вы зададите A-запись в DNS, у вас не будет работать https, потому что вся https-секция закомментирована. 24 июл 2018 в 7:32
  • basis.zahp.ru будет нормально?
    – Geo
    24 июл 2018 в 7:37
  • что значит - нормально? кому - нормально? 24 июл 2018 в 7:39
  • будет DNS resolved?
    – Geo
    24 июл 2018 в 7:41
  • + не вижу секцию https
    – Geo
    24 июл 2018 в 7:43

1 ответ 1

0

https://www.8host.com/blog/nastrojka-virtualnyx-xostov-nginx-v-ubuntu-16-04/

в качестве server_name лучше использовать ip сервера

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.