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.

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay