One-click installation of hand-torn cabbage (DHT magnet), creation of Nginx reverse generation, and setting up SSL connection

One-click installation of hand-torn cabbage (DHT magnet), creation of Nginx reverse generation, and setting up SSL connection

Applicable to VPS with swap and system of centos 7.

1. Install the shredded cabbage
1. Uninstall Apache

 yum -y remove httpd

And install the necessary components

 yum update -y yum install screen wget unzip gcc gcc-c++ python-devel -y

Turn off firewall

 systemctl stop firewalld.service ; systemctl disable firewalld.service

2. Installation

 wget https://zhujiwiki.com/wp-content/uploads/2016/03/ssbc1.1.sh sh ssbc1.1.sh

Select Y to browse the web with a browser, and then set your username and password.

3. Set a scheduled restart

 wget https://zhujiwiki.com/wp-content/uploads/2016/03/ssbc-reboot.sh chmod +x ssbc-reboot.sh crontab -e

Press i to enter edit mode

 0,30 * * * * sh /root/ssbc-reboot.sh

Press the Esc key to exit the edit mode, then hold down the shift key and press z twice to return to the shell interface.

0,30 sh /root/ssbc-reboot.sh
This means that the ssbc-reboot.sh file will be automatically executed at 0 and 30 minutes per hour.

You can also set a longer time, such as restarting at 1:00 a.m. every night:

 0 1 * * * sh /root/ssbc-reboot.sh

Or restart once every 2 hours:

 0 */2 * * * sh /root/ssbc-reboot.sh

At this point, the magnet site has been built and can be accessed using your server IP or by binding a domain name.

2. Install Nginx, PHP, and set up SSL private connection <br />The port 8080 that appears below can also be changed to other ports.

1. Kill the process of shredded cabbage and detect the python 80 port process ID:

 ps aux | grep python

 kill -9 2344 2439

2. Install Nginx and PHP
a. Use the LNMP one-click installation package to install Nginx and PHP, and do not install other packages.
b. Install Let's Encrypt client

 ./addons.sh

Select 7 and install it. (Let's Encrypt client is a free SSL certificate)

3. Edit the firewall to allow communication on port 8080

 vi /etc/sysconfig/iptables

Add to

 -A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT

Restart the firewall

 systemctl reload iptables.service

4. Create a website and set up anti-generation
a. Create a website

 cd /root/lnmp ./vhost.sh

b. Set up reverse proxy

 cd /usr/local/nginx/conf/vhost

Edit the website configuration created earlier:

 vi freecili.com.conf

Add the following code:

 location / { proxy_pass http://你的服務器IP:8080; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for; proxy_set_header Host $host:$server_port; proxy_set_header X-Forwarded-Proto $scheme; proxy_connect_timeout 600; proxy_read_timeout 600; proxy_send_timeout 600; client_max_body_size 1024M; # Set higher depending on your needs }

Set your server IP to your IP address

Restart Nginx service

 service nginx restart

5. Rebuild the process of shredded cabbage:

 cd /root/ssbc-master nohup python manage.py runserver 0.0.0.0:8080 &gt;/dev/zero &amp;

6. Edit ssbc-reboot.sh
a. Change the port in ssbc-reboot.sh to 8080

 vi ssbc-reboot.sh

b. Add the restart Nginx command under the third line:

 systemctl restart nginx.service

Demo : http://cili.sib8.net/

7. Close or disable firewall and iptables

 systemctl stop firewalld.service systemctl disable firewalld.service systemctl stop iptables.service systemctl disable iptables.service

3. Some problems solved :
1. You can move the database directly when moving: /var/lib/mysql/ssbc/
Then execute the command:

 chmod +x /etc/rc.d/rc.local echo "systemctl start mariadb.service " >> /etc/rc.d/rc.local echo "cd /root/ssbc-master " >> /etc/rc.d/rc.local echo "indexer -c sphinx.conf --all " >> /etc/rc.d/rc.local echo "searchd --config ./sphinx.conf " >> /etc/rc.d/rc.local echo "nohup python manage.py runserver 0.0.0.0:80 >/dev/zero 2>&1& " >> /etc/rc.d/rc.local echo "cd workers " >> /etc/rc.d/rc.local echo "nohup python simdht_worker.py >/dev/zero 2>&1& " >> /etc/rc.d/rc.local echo "nohup python index_worker.py >/dev/zero 2>&1& " >> /etc/rc.d/rc.local

Then restart it and it will be normal

2. Search for Chinese errors. If it is a centos7 system, modify /usr/lib64/python2.7/site.py
vi /usr/lib64/python2.7/site.py
Add two lines under import sys:
reload(sys)
sys.setdefaultencoding('utf8')

3. How to confirm that the web server, collection, and storage are running?
ps -ef | grep python
The results include
python manage.py runserver 0.0.0.0:80
python simdht_worker.py
python index_worker.py
It means it is running.

via: hostloc1, hostloc2, some parts have been modified.

<<:  Pzea: $28/year/512MB memory/30GB space/800GB traffic/10 IP/OpenVZ/Los Angeles

>>:  Hostigation 1GB RAM SSD Hard Drive KVM VPS Los Angeles Simple Review

Recommend

RAKsmart 512MB RAM 1Gbps Limited Traffic San Jose KVM VPS Review

Details : RAKsmart: $2.79/month/256MB RAM/10GB SS...

spryservers: Nextcloud storage, 10GB free; 25GB for $2.50/month

spryservers, a foreign merchant, provides VPS, de...

BandwagonHost 512MB RAM Los Angeles MCOM KVM VPS Review

Details: BandwagonHost: $19.99/year/512MB memory/...

Inertia Networks: $5/month/1GB memory/30GB space/1TB traffic/XEN/Los Angeles

Inertia Networks, an American hosting company, wa...

VMHaus: $15/year/256MB RAM/5GB NVMe space/1TB bandwidth/KVM/Los Angeles/UK

VMHaus is a foreign hosting company registered in...