Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the simple operation and maintenance techniques of PHP programmers?

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the knowledge about "what are the simple operation and maintenance technologies of PHP programmers". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

1. Linux system basic commands and Windows Server operations

Is the base of the base, ls, rm, top, w, mkdir, find, cp, mv, kill, killall, cat, chown, chmod, time... Wait, command parameters don't have to be mastered. When you need them, you can check them.

2. Web Service Environment Configuration

Common NGINX and APACHE to be familiar with, WIN can use IIS, in some cases need TOMCAT also to understand, generally use the installation package or installation command is more convenient. Some installation commands are described later.

Shell script or BAT batch processing

Simple to write a backup script or file processing and the like, convenient and fast.

4. Database

Most use MYSQL, generally master data migration, bad data repair can be.

Firewall (security rules)

WIN generally uses IP policy, linux with IPTABLES and hosts.allow can prevent routine unauthorized access, also described in detail later.

6. Monitoring tools (inventory monitoring)

Relatively speaking, it is important to ensure the normal operation of the business. If conditions permit, you can write your own monitoring alarm script, or you can use third-party tools such as cacti, nagios, zabbix, etc. Some companies also provide monitoring services, such as monitoring treasure, Alibaba Cloud Monitor, Baidu Cloud Observation, 360 Monitoring, and SMS or email notifications after business errors.

7. Cluster and hot standby

There are many tools that can be deployed according to the actual situation. For WEB services, there are basically two points: files and databases.

8. Data backup

All business data is backed up regularly offsite through scripts or tools, usually between 1:00 a.m. and 3:00 a.m. during server idle time.

Here are some general operating methods in detail

View server load top

load average: 0.76, 0.72, 0.70 Generally check this value, *** data generally within 1 means that the operation is in good condition, the specific meaning of other data can be checked, not detailed here. This load average data can also be viewed quickly with the w command.

Edit books or profiles command vim

In general, when the system is newly installed, it does not come with vim, but vi can also be used instead.

There are also many tutorials on the Internet, you can find and learn.

install software

Yum install is usually used under centos, such as

yum install bash-compleition

Using apt-get install in ubuntu

EXE can be executed directly under win (white will)

bash-compilation can automatically complete command parameters, relatively easy to use

Encounter software that needs to be compiled, some of the streamlined systems need to install yum install -y gcc gcc-c++ to install some of the necessary extension libraries to pass, but when the error prompt to find a solution.

Install apache generally use yun install httpd, install according to the prompt and execute service httpd start,

A green OK indicates that the installation is successful, and the subsequent PHP environment can execute the installation command according to specific requirements.

nginx general installation command

yun install nginx

Focus on security strategy

Access permissions for apache directories are as follows

Options FollowSymLinks AllowOverride None Order Deny,Allow Deny From all Allow From 2.2.2.2 Allow From 2.2.2.3

This means that the/www directory only allows access to the specified ip2.2.2.2 2.2.2.3, which is suitable for internal system use.

To be on the safe side, you can also make restrictions in IPTABLES.

vim /etc/sysconfig/iptables*filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -s 1.1.1.1 -j DROP -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -s 2.2.2.2 -j ACCEPT -A INPUT -s 2.2.2.3 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT

-A INPUT -s 1.1.1.1-j DROP This sentence means that any request for the IP 1.1.1.1 is prohibited.

The other rules mean that all requests for 2.2.2.2 and 2.2.2.3 are allowed, and ports 22 and 80 are open.

At the same time, add the ip of the trusted host to hosts.allow

vim /etc/hosts.allowALL:2.2.2.2 ALL:2.2.2.3 sshd:ALL:deny

This allows only authorized IPs to remotely connect to this server, and no other machine can log in.

Win server can achieve the same effect by setting the following settings: Start-> Administrative Tools-> Local Security Policy Take 2008 as an example, other versions are similar

Add a rule denying access to all ip ports by default. Be careful when doing this remotely. Add it before the rule takes effect, otherwise the connection will be disconnected.

The second rule is to add your own trusted ip, and the rule is release.

Article 3: Open ports that need to be external, such as 80

Overall rules, specific setting steps need to be practiced several times.

*** Right-click this policy and select Assign, effective immediately

other 1

Local Data Backup Script

tar -zcvf /home/bak/file_$(date -d "yesterday" +"%Y%m%d").bak.tar.gz /www

The script file is placed in/apptool/bak.sh, which means that the/www directory is compressed under the/home/bak directory and named file_date_bak.tar.gz.

And then put it in crontab and execute it every night on a regular basis

crontab -e

00 00 * * * /bin/bash /apptool/bak.sh

Remote backup can choose to use flashfxp to do a good job of periodic pull files can be.

Database backup can choose to use navicat to do remote connection settings, and then do backup rules.

other 2

For the convenience of development and maintenance, you can deploy some automated programs, you can set up a periodic pull of the contents of the version library in the test environment, to achieve automatic updates, developers can preview the modified content in real time after local submission.

Formal environments can also be scripted for one-click updates.

other 3

Master some general pressure testing tools to verify the performance of programs and servers, such as wrk, ab, webbench, hping

AB can be used directly on machines with apache installed. Generally, the target host is its own server, such as

ab -c100 -n1000 http://www.host.com/

100 concurrent requests to the target host, a total of 1000 requests. After the command ends, some information summary detection will appear. At the same time, it is necessary to observe the resource consumption of the target host.

Hping tool is also very easy to use, specific use methods can be consulted using documentation.

other 4

IPtraf, tcpdump, ngrep, nethogs, nload, iftop and other network detection and diagnostic tools can be used to effectively find and solve related problems.

Basic commands netstat, ping, traceroute... It needs to be mastered and used.

You can also use some detection sites, such as 17ce, alibench and other quality detection sites to help find problems.

"What are the simple operation and maintenance technologies of PHP programmers?" The content is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report