Home > Backend Development > PHP Tutorial > php mysql apache ftp configuration under centOs, centosapache_PHP tutorial

php mysql apache ftp configuration under centOs, centosapache_PHP tutorial

WBOY
Release: 2016-07-13 09:56:30
Original
801 people have browsed it

php mysql apache ftp configuration under centOs, centosapache

made corresponding notes when installing the server. This method is successful through personal experience. As the version is constantly updated, There may be some differences, but the basic principles are the same.

1. Install CentOS 6, you can choose minimal installation or desktop installation

2. Upgrade the system

yum update
3. Install mysql, set mysql to start automatically when booting, and start mysql at the same time

yum install mysql
yum install mysql-server
chkconfig --levels 35 mysqld on
service mysqld start

4. Configure the root password of mysql

mysql>; USE mysql;
mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';
mysql> ;; FLUSH PRIVILEGES;

You can also use the mysql_secure_installation command to set the mysql password

mysql_secure_installation

Enter current password for root (enter for none): (Enter)
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorization.

Set root password? [Y/n] (Y)

New password: (123456)
Re-enter new password: (123456)
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]

(Whether to remove the default account of the database? If so, entering mysql directly in the terminal will prompt a connection error) Y

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]

(Whether root remote login is prohibited)Y
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

**Later set whether to allow remote login
mysql -u root -p
Enter Password:
mysql>GRANT ALL PRIVILEGES ON *.* TO 'username'@ '%' IDENTIFIED BY 'Password' WITH GRANT OPTION;
After completion, you can use mysql-front to remotely manage mysql.
Set to start at boot
chkconfig mysqld on

5. Install apache and set it to start at boot

yum install httpd
chkconfig --levels 35 httpd on
service httpd start
At this time you can test whether apache is working normally

It should be no problem to access localhost directly through the browser, but if other machines cannot access it, it is because of the firewall. Configure the firewall

(SSL will have this problem later)

6. Install php

If you install a version below php53, it may cause the project to be unable to run in this environment. When php5.2 is installed, the result will be
Now the project cannot run at all. After looking for the reason for a long time, I found out that the php version is too low (before this, I always thought it was because of json, because
php5.2 does not have json extension), so you must check the version before installation, otherwise it will be difficult to find out the cause of problems in the future project.

yum install php53

yum install php53-mysql php53-gd php53-imap php53-ldap php53-odbc php53-pear php53-xml php53-
xmlrpc
At this time, PHP is installed and pulled. Write a script to test it

vi /var/www/html/info.php
Enter

phpinfo();?>
Just visit localhost/info.php~

7. Install phpMyAdmin

First install the two large software warehouses epel and rpmfushion on the system

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
rpm -Uvh http://download1.rpmfusion.org /free/el/updates/testing/6/i386/rpmfusion-free-release-
6-0.1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/testing/6/i386/rpmfusion-
nonfree-release-6-0.1.noarch.rpm
If it is centos 5, execute the following

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://download1.rpmfusion .org/free/el/updates/testing/5/i386/rpmfusion-free-release-
5-0.1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/testing/5/i386/rpmfusion-
nonfree-release-5-0.1.noarch.rpm
It is very convenient to install. You can get the latest version without downloading at all

yum install phpmyadmin
After the installation is completed, you need to configure the access permissions so that other machines besides this machine can also access phpMyAdmin

vi /etc/httpd/conf.d/phpMyAdmin.conf
Find the permission settings of the two directories, change Allow from to All


Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from All


Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from All

Restart the server

service httpd restart
Test localhost/phpMyAdmin

Username and password: root 123456

OK~ LAMP is set up,

8. Build SSL and let apache support https

yum install mod_ssl
In fact, after installing this module, you can use https://localhost to test after restarting apache, because it created a default certificate

Under /etc/pki/tls

Of course we can also use openssl to create our own certificate

yum install openssl
Generate certificate file
Create an rsa private key, the file name is server.key

openssl genrsa -out server.key 1024

Generating RSA private key, 1024 bit long modulus
............
............
e is 65537 (0x10001 )


Use server.key to generate a certificate signing request CSR

openssl req -new -key server.key -out server.csr
Country Name: two-letter country code
State or Province Name: province name
Locality Name: city name
Organization Name: Company name
Organizational Unit Name: Department name
Common Name: Your name
Email Address: Address
As for the 'extra' attributes, there is no need to enter them. Just press Enter

Generate certificate CRT file server.crt.

openssl x509 -days 365 -req -in server.csr -signkey server.key -out server.crt
Modify ssl.conf to specify our own generated certificate

vi /etc/httpd/conf.d/ssl.conf
Find the following location and modify the path

# Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. A new
# certificate can be generated using the genkey(1) command.
SSLCertificateFile /etc/pki/tls/certs/localhost.crt

# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

OK

service httpd restart

yum install vsftpd

2. Start/restart/shut down vsftpd server
/sbin/service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
OK means the restart is successful .
Change restart to start/stop respectively for startup and shutdown.
If it is installed from source code, go to the installation folder to find the start.sh and shutdown.sh files and execute them.

Modify according to the following

vi /etc/vsftpd/vsftpd.conf

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO

# if your users expect that (022 is used by most other ftpd's)
local_umask=022
local_root=/

vi /etc/vsftpd/ftpusers

# Users that are not allowed to login via ftp
#root

vi /etc/vsftpd/user_list

# for users that are denied.
#root

Firewall configuration
a. Add. Allow access to port {80: http}.
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
b. Turn off the firewall {not recommended}.
service iptables stop
c. Reset the loading firewall
service iptables restart

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/987569.htmlTechArticlephp mysql apache ftp configuration under centOs, centosapache made corresponding notes when installing the server. This method is personally With successful experience, as the version is constantly updated, there may be...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template