Smartphone access, Stable Diffusion, and open ports: easily generate high-quality images on the go

stable diffusion web ui can be accessed using a browser. So you can access Stable Diffusion running on your home PC when you are out of the office. you can also remote Windows or Linux, but we will use only a browser to access it. First, we will check it from another PC or phone in the LAN. In this case, we will start Stable Diffusion on Windows. At that time, you should see the following message in the command prompt; this is not the case if you are on WSL or using Docker.

http://127.0.0.1:7860

In this situation, you cannot access the system from any computer other than the one you are running on. So, edit the batch file (webui-user.bat) with notepad or something. The meaning of the command is described in the official page.

https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Command-Line-Arguments-and-Settings

The following is an example of allowing access from anywhere and changing the port number from the default value of 7860 to 80.

@echo off

set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=--xformers --listen --port 80

call webui.bat

Overwrite, save, and restart Stable Diffusion. At the command prompt, you will see that the URL has changed.

In this case, on the computer where Stable Diffusion is running, the URL is

http://localhost

Now you can access Stable Diffusion from other computers or smartphones in your LAN.

It is very common to use the ipconfig command to check the IP address of a local computer in a Windows environment. ipconfig is a command that can be run from a command prompt or PowerShell that provides detailed information about the network connection. It provides detailed information about the network connection.

Using this command, the following information is displayed

  • IP address: The address by which the computer is identified on the local network.
  • Subnet mask: An address that identifies which parts of the network are local and which parts are external.
  • Default gateway: Usually the IP address of the router on the local network.

ipconfig is useful for a quick review of basic information. If you need more detailed information or information about a specific network adapter, you can use additional options such as ipconfig /all.

In addition, configure the Windows firewall to receive from other devices. Add to the rules of reception in the windows defender firewall with enhanced security.


Adding rules to the Windows Defender firewall to allow access from other PCs is one of the most common uses. Such a setting is made when certain applications or services need to communicate with other computers over the network. Examples include file sharing, remote desktop connections, and the online capabilities of certain games or applications.

When adding such rules, it is important to note the following in order to maintain security

  1. Minimize the necessary settings: Do not allow an unnecessarily large number of ports or applications. Limit the number to only those that are necessary.
  2. Allow only trusted applications: Avoid granting access to untrusted applications and services.
  3. Check and update regularly: It is important to review the rules you set regularly and remove those that are no longer needed.

Thus, it is common practice to properly configure firewall rules to allow necessary communications while maintaining security.

The types of rules are ports. For the specific local port, enter 80, which you changed earlier.

I was able to access the site from Ubuntu Desktop and my phone within the LAN (devices using WIFI on the same router). Images could also be generated. The speed of generation depends on the computer on which Stable Diffusion is running.

The output destination of the generated images can be an online storage like DropBox for quick image viewing. Please refer to the following article for details on how to change the model location and output destination.

Finally, set up the connection so that you can connect on the go. Add a description of port opening on your home router. On my home router, I found a NAT forwarding item called port forwarding, so I set it here. This will allow you to connect from outside the house.

Router port opening (port forwarding) is an important setting that allows devices on the Internet to have direct access to specific computers and services in the local network. This setting is used when a particular application or service requires a connection from the outside. The main significance of this setting is as follows

  1. Enabling external access: Opening a port on the router allows other devices on the Internet to access a particular machine or service in the local network. Examples include remote desktops, online games, web servers, FTP servers, etc.
  2. Improved application functionality: Some applications and services may not function properly or perform poorly if the appropriate ports are not open. For example, online games and P2P applications (e.g. BitTorrent) may perform poorly without proper port opening.
  3. Providing certain services: If you provide web page or file sharing services from a home server, for example, you may need to open ports to allow access from the outside.
  4. Solving NAT (Network Address Translation) problems: Many home networks use NAT, whereby multiple devices share a single public IP address to access the Internet. Port opening provides a means to directly access a particular device from the outside through a specific port in this NAT environment.

However, opening ports involves security risks, so it is important to open ports only for services and applications that need them and to close ports when they are no longer in use. Firewalls and security software must also be properly configured to prevent unauthorized access.

If a global IP address is shared by multiple users through cable TV Internet service or a condominium’s shared Internet connection, there are several challenges when publishing a private server. However, there are several ways to overcome these challenges:

  1. Configure port forwarding: First, you must configure port forwarding on your own router. This allows you to forward external communications on specific ports to specific devices in your local network. However, this method may not be sufficient if global addresses are shared.
  2. Using Static IP Service: One solution is to contact your Internet Service Provider (ISP) and ask them to assign you a static IP address (a fixed global IP address). This will allow outside parties to access the server through a specific IP address.
  3. Using DDNS (Dynamic DNS) service: DDNS service allows you to assign a fixed domain name to a dynamically changing IP address. This allows you to access the server using the same domain name even if the IP address changes.
  4. Using a VPN service: You can also use a VPN service to set up a fixed global IP address on an external server and access your home server through that server. The VPN server serves as a relay point.
  5. Using cloud services: Instead of running your server at home, another option is to use a cloud service such as AWS, Azure, or Google Cloud Platform to build your server in the cloud.
Please share if you like it!
TOC