# Server Hosting

### Linux Server Hosting

1. Create (self-contained)build of your server, navigate to your solution folder, and run the command below. It will generate a publish folder under {your solution}/bin/Release/net5.0/linux-x64/publish \
   copy publish folder and upload it to your server.

```batch
dotnet publish --self-contained -c Release -r linux-x64
```

2\. Once your app is uploaded to the server, open the terminal window and execute the following command. It will grant execute permission to your app. \
**Note**\* run this command after navigating to the build folder.

```batch
chmod 777 ./appname
```

3\. Run your application

```batch
./appname
```

### Windows Server Hosting

1.  &#x20;Create (self-contained) build of your server, navigate to your solution folder, and run the command below. It will generate a publish folder under {your solution}/bin/Release/net5.0/win10-x64/publish \
    copy publish folder and upload it to your server.

    ```batch
    dotnet publish -c Release -r win10-x64
    ```

2\. Add inbound/outbound rules of ports at your server is listening&#x20;

![](https://2818635545-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mi5m6nRO5vqi3KSpWcd%2Fuploads%2FrxWyZwQlI3Z4NGZD7bG7%2Ffire_wall.png?alt=media\&token=feb029f4-09c7-40cf-a84d-ce8a7bf1b118)

3\. Run your server as administrator&#x20;
