DEV Community

Elif Nur Turk
Elif Nur Turk

Posted on

Configuring .env file remotely on your VPS

Configuring .env file remotely on your VPS

The .env file typically holds sensitive information such as API keys, database credentials, and configuration settings. This file should be created and managed securely to ensure your application's proper operation.

Access your VPS and navigate to the directory

`cd /path/to/your/directory`
Enter fullscreen mode Exit fullscreen mode

Let’s create an .env file in directory.

vi .env

This command will generate a .env file in your specified directory.
To edit the file, simply execute the command "i".

i

Afterward, you can paste your environment variables directly into the file.

To save and exit, press Esc and then run the appropriate command.

:wq

Now its saved. You can then rebuild your application and restart the VPS server to apply the changes.

Top comments (0)