Access NGINX virtual host in LAN


Ivan

I want to access a virtual host on a development workstation (Arch Linux) from a mobile device or tablet connected in the same network.

My nginx.conf virtual host spec looks like this:

http {

include mime.types;
default_type application/octet-stream;

sendfile on;
keepalive_timeout 65;
client_max_body_size 16M;

# Domain site1.dev
server {
    server_name site1.dev;
    listen 80;
    root /path/to/dir;

    location / {
        root /path/to/dir;
        index index.php;
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /path/to/dir/$fastcgi_script_name;
        include fastcgi_params;
    }
}

}

My /etc/hosts file contains:

127.0.0.1    localhost localhost.localdomain site1.dev
192.168.1.11 site1.dev

This works on localhost, but I can't access site1.dev from a phone or tablet connected in the same network. It only works when using the IP address 192.168.1.11. Is there some way to make it work using the site1.dev name ?

incite

Your dev workstation 's files are only readed from your dev workstation/etc/hosts when you open a browser (or want to reach the web) . If you are accessing the network from a mobile device, the development workstation 's will be ignored./etc/hosts

If you also want to access from your phone or tablet 192.168.2.11, you should site1.devcreate an -entry on each device /etc/hosts(same as your workstation).

Another possibility is to use the router when it supports native DNS functionality .

Alternatively, a complicated solution (very ugly hack) is to install a DNS server on your workstation and set the router's DNS to your workstation's IP.

Related


Access NGINX virtual host in LAN

Ivan I want to access a virtual host on a development workstation (Arch Linux) from a mobile device or tablet connected in the same network. My nginx.conf virtual host spec looks like this: http { include mime.types; default_type application/octet-stream; sen

Access NGINX virtual host in LAN

Ivan I want to access a virtual host on a development workstation (Arch Linux) from a mobile device or tablet connected in the same network. My nginx.conf virtual host spec looks like this: http { include mime.types; default_type application/octet-stream; sen

Access NGINX virtual host in LAN

Ivan I want to access a virtual host on a development workstation (Arch Linux) from a mobile device or tablet connected in the same network. My nginx.conf virtual host spec looks like this: http { include mime.types; default_type application/octet-stream; sen

Access NGINX virtual host in LAN

Ivan I want to access a virtual host on a development workstation (Arch Linux) from a mobile device or tablet connected in the same network. My nginx.conf virtual host spec looks like this: http { include mime.types; default_type application/octet-stream; sen

Access NGINX virtual host in LAN

Ivan I want to access a virtual host on a development workstation (Arch Linux) from a mobile device or tablet connected in the same network. My nginx.conf virtual host spec looks like this: http { include mime.types; default_type application/octet-stream; sen

Create a virtual host with Nginx

Daniel Ticanti I have a problem with my virtual host using nginx wherever I go into www/html instead of www/example1 folder. Can anyone spot the problem? Am I missing something? pi@homeserver:/etc/nginx/sites-enabled $ ls -l total 4 -rw-r--r-- 1 root root 467

Create a virtual host with Nginx

Daniel Ticanti I have a problem with my virtual host using nginx wherever I go into www/html instead of www/example1 folder. Can anyone spot the problem? Am I missing something? pi@homeserver:/etc/nginx/sites-enabled $ ls -l total 4 -rw-r--r-- 1 root root 467

Nginx virtual host caches symlinks

Mike Scheneveld I am having trouble deploying the application. I have a PHP application and deploy the application with Capistrano to the server. Capistrano creates a new release folder with the latest version of my app, and my current folder is symlinked to t

Create virtual host on Nginx server

Gaurav Dave I've been working a lot with LAMP lately, but now, I'm starting to work with Nginx. So I installed nginx and wanted to create virtual hosts because LAMP has a different folder structure than standalone nginx and couldn't understand how to create vi

Include virtual host file in Nginx

Omid Kamangar Previously, I installed Nginx on my CentOS 6 machine via yum. This gives me /etc/nginx/conf.dfolders where each site creates a separate file containing serverdirectives and other configuration . Now, I have to add Phusion Passenger support to Ngi

How to setup virtual host in Nginx?

Manoi Kumar I am using the following configuration settings but it is downloading the index source files when executing. But it shows the output of index.html (if placed) instead of the output of index.php In general, it doesn't seem to read PHP files. server

Create virtual host on Nginx server

Gaurav Dave I've been working a lot with LAMP lately, but now, I'm starting to work with Nginx. So I installed nginx and wanted to create virtual hosts because LAMP has a different folder structure than standalone nginx and couldn't understand how to create vi

How to setup virtual host in Nginx?

Manoi Kumar I am using the following configuration settings but it is downloading the index source files when executing. But it shows the output of index.html (if placed) instead of the output of index.php In general, it doesn't seem to read PHP files. server

Create virtual host on Nginx server

Gaurav Dave I've been working a lot with LAMP lately, but now, I'm starting to work with Nginx. So I installed nginx and wanted to create virtual hosts because LAMP has a different folder structure than standalone nginx and couldn't understand how to create vi

Access the virtual machine from the host

Ubaid Ahmed My host's OS is Windows and I'm using Oracle Virtual box . I have 3 virtual machines: Kali Linux , Metasploitable and Windows 10 . Question 1: I host a website in Metasploitable. If I use NAT network, I can access the site using IP in Kali Linux an

from remote access virtual host?

Lord 3d I have a Linux (debian7), I run many different virtual hosts (for all my projects) - apache2, I usually use my dev server to test new features via mobile (for mobile), but it takes a long time time. How to set up a configuration on Linux so that the vi

Access the virtual machine from the host

Ubaid Ahmed My host's OS is Windows and I'm using Oracle Virtual box . I have 3 virtual machines: Kali Linux , Metasploitable and Windows 10 . Question 1: I host a website in Metasploitable. If I use NAT network, I can access the site using IP in Kali Linux an

Access the virtual machine from the host

Ubaid Ahmed My host's OS is Windows and I'm using Oracle Virtual box . I have 3 virtual machines: Kali Linux , Metasploitable and Windows 10 . Question 1: I host a website in Metasploitable. If I use NAT network, I can access the site using IP in Kali Linux an