2024-11-02 11:18:41 +01:00
|
|
|
# Website<br/>
|
|
|
|
This is all the code for the website (deadvey.com)<br/>
|
2023-12-29 02:35:11 +01:00
|
|
|
|
2024-11-02 11:18:41 +01:00
|
|
|
# Node
|
|
|
|
The nodejs code that is executed in the background is in /node<br/>
|
|
|
|
You can execute the node code in crontab (`crontab -e`)<br/>
|
|
|
|
eg:<br/>
|
2024-11-02 11:43:48 +01:00
|
|
|
```cron
|
2024-11-02 11:18:41 +01:00
|
|
|
* * * * * node /var/www/html/node/makeblogs.js
|
|
|
|
* * * * * node /var/www/html/node/newsletter.js
|
|
|
|
* * * * * node /var/www/html/node/updatefeed.js
|
2024-01-08 19:08:58 +01:00
|
|
|
|
2024-11-02 11:18:41 +01:00
|
|
|
etc...
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
# Newsletter
|
|
|
|
<br/>
|
2024-11-02 11:20:01 +01:00
|
|
|
If you want to add members to the newsletter, I store a file as /etc/newsletter_members.js:<br/>
|
2024-11-02 11:42:48 +01:00
|
|
|
|
|
|
|
```js
|
2024-11-02 11:18:41 +01:00
|
|
|
let members = ["member1@gmail.com","member2@outlook.com"]
|
|
|
|
|
|
|
|
if (typeof module !== 'undefined' && module.exports) {
|
|
|
|
module.exports = members;
|
|
|
|
}
|
2024-11-02 11:42:48 +01:00
|
|
|
|
2024-11-02 11:18:41 +01:00
|
|
|
```
|
2024-11-02 11:48:17 +01:00
|
|
|
# Apache2 and Node.js Integration
|
2024-11-02 11:42:48 +01:00
|
|
|
|
2024-11-02 11:48:17 +01:00
|
|
|
This project utilizes Apache2 as a reverse proxy to handle incoming web traffic and forward requests to a Node.js application.
|
|
|
|
## Configuration
|
2024-11-02 11:32:56 +01:00
|
|
|
|
2024-11-02 11:48:17 +01:00
|
|
|
To set up Apache2 as a reverse proxy for your Node.js app:
|
|
|
|
|
|
|
|
Start your Node.js application (/node/app.js) on port 8003. You can run the application in a tmux session using the command:
|
|
|
|
|
|
|
|
``` node app.js```
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
|
|
|
|
```ProxyPass / http://localhost:8003/```
|
|
|
|
|
|
|
|
If you have other sites or applications running on Apache2 that should not be proxied to Node.js, you can add exceptions like this:
|
|
|
|
|
|
|
|
|
|
|
|
```ProxyPass /wordpress !```
|
|
|
|
|
|
|
|
Replace /wordpress with the appropriate path for your exception.
|
|
|
|
|
|
|
|
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.
|