Archive
Posts Tagged ‘javascript’
How to self-host Expo webapp with Apache 2.4
3 juillet 2020
Laisser un commentaire
This short howto comes from a github pull request not merged.
1. Build your Expo web app
Use the command provided by expo:
$ expo build:web
2. Provide the web-build/ directory to the server
Several ways are available according to your workflow.
For example:
- copy the
web-build/directory to/path/to/web-build/on the server withscporsftpcommands. `ssh` server is required on the server. Create distant path (/path/to/) before copyingweb-build/directory. - configure Continuous Integration to build and deploy the
web-build/directory.
3. Configure Apache webserver
Apache will host the generated static files.
Create a file at /etc/apache2/sites-available/expo.conf with:
<VirtualHost ip-server:80>
ServerAdmin [email protected]
ServerName domain-for-the-app
Alias / /path/to/web-build/
<Directory /path/to/web-build/>
Require all granted
</Directory>
</VirtualHost>
You have to change ip-server, [email protected], domain-for-the-app and /path/to/web-build/ according to your setup.
ip-server: IP used by the server to receive requests from the clients[email protected]: e-mail address shown to the client if a server error occursdomain-for-the-app: domain where the files are served to the client. When users go to `http://domain-for-the-app` with a browser, the app will be loaded/path/to/web-build/: path where the web-build/ directory is
4. Enable the new VirtualHost
$ sudo a2ensite expo
5. Restart Apache
$ sudo systemctl restart apache2
6. It works!
Check that the webapp is available at domain-for-the-app with a browser.
Catégories :Autre
javascript