Created
April 13, 2018 00:52
-
-
Save paveltretyakovru/ae20a4259ef18a65d611a5d590fa194c to your computer and use it in GitHub Desktop.
Nginx host configuration to webpack application developing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127.0.0.1 localhost | |
127.0.0.1 mydev.app | |
192.168.0.2 mydev.app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Nginx config file /etc/nginx/sites-available/mydev | |
# To enable site | |
# cd /etc/nginx/sites-enabled | |
# ln -s ../sites-available/mydev . | |
# sudo service nginx restart; sudo service nginx status | |
upstream mydev.app { | |
server mydev.app:8080; | |
} | |
server { | |
listen 80; | |
server_name mydev.app; | |
location / { | |
proxy_pass http://mydev.app; | |
proxy_redirect off; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
const HOST = 'mydev.app' | |
module.exports = { | |
// ... | |
entry: [ | |
// ... | |
`webpack-dev-server/client?http://${HOST}:8080/`, | |
// .... | |
], | |
devServer: { | |
hot: true, | |
port: 8080, | |
host: HOST, | |
contentBase: `${__dirname}/public`, | |
historyApiFallback: true | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment