Compare commits
No commits in common. "de9620759af3c41236f2a6f103770a5d07c3e560" and "65bfc08ea04655791e8bb578ae35390d54546997" have entirely different histories.
de9620759a
...
65bfc08ea0
40
README.md
40
README.md
@ -26,37 +26,13 @@ if (typeof module !== 'undefined' && module.exports) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
# Apache2 and Node.js Integration
|
|
||||||
|
|
||||||
This project utilizes Apache2 as a reverse proxy to handle incoming web traffic and forward requests to a Node.js application.
|
# Setup
|
||||||
## Configuration
|
I use apache2 to run the website and accept traffic, though for the main site it runs on nodejs which is hosted on port :8003<br/>
|
||||||
|
You can run /node/app.js in a tmux session for the website<br/>
|
||||||
|
You can add this to /etc/apache2/sites-enables/000-default.conf to forward to nodejs:<br/>
|
||||||
|
`ProxyPass / http://locahost:8003/`<br/>
|
||||||
|
And this if you want other sites that use apache2 not nodejs (as exceptions)<br/>
|
||||||
|
`ProxyPass /wordpress !`<br/>
|
||||||
|
You can also check the node page is running with `curl http://localhost:8003`<br/>
|
||||||
|
|
||||||
To set up Apache2 as a reverse proxy for your Node.js app:
|
|
||||||
|
|
||||||
1. Start your Node.js application (/node/app.js) on port 8003. You can run the application in a tmux session using the command:<br/>
|
|
||||||
|
|
||||||
``` node app.js```
|
|
||||||
|
|
||||||
2. Edit the Apache configuration file /etc/apache2/sites-enabled/000-default.conf and add the following lines to forward requests to the Node.js app:<br/>
|
|
||||||
|
|
||||||
|
|
||||||
```ProxyPass / http://localhost:8003/```<br/>
|
|
||||||
|
|
||||||
3. If you have other sites or applications running on Apache2 that should not be proxied to Node.js, you can add exceptions like this:<br/>
|
|
||||||
|
|
||||||
|
|
||||||
```ProxyPass /wordpress !```<br/>
|
|
||||||
|
|
||||||
Replace /wordpress with the appropriate path for your exception:<br/>
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
To verify that the Node.js application is running and accessible through Apache2, you can use the curl command:
|
|
||||||
|
|
||||||
|
|
||||||
```curl http://localhost:8003```
|
|
||||||
|
|
||||||
|
|
||||||
This should return the response from your Node.js application.
|
|
||||||
|
|
||||||
Feel free to customize and expand this documentation based on your specific project requirements and additional details you would like to include.
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user