Install and configure Ngnix_tomcat_PHP_Mysql and centosmysql in CentOS
Install Nginx
yum install nginx
If the nginx package cannot be found, create a new file/etc/yum. repos. d/nginx. repo. content:
[nginx]name=nginx repobaseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/gpgcheck=0enabled=1
Replace OS with centos or rhel, and replace OSRELEASE with 5, 6, or 7 based on your installed Release Version, corresponding to 5. Think, 6.x, 7. x, for example:
[nginx]name=nginx repobaseurl=http://nginx.org/packages/centos/6/$basearch/gpgcheck=0enabled=1~
Delete the previous httpd
yum remove httpd
Install
yum install ngnix
Determine conf
/usr/sbin/nginx -t
Start: service nginx restart
Add self-starting chkconfig -- levels 235 nginx on
Install PHP
yum install php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy
Vi/etc/php. ini
Add cgi. fix_pathinfo = 1 at the end of the file
Start php-fpm:
service php-fpm start
Php-fpm is added to the startup Item:
chkconfig --levels 235 php-fpm on
Install Tomcat, download and unzip it to/usr/local/tomcat, and change the port to 8090.
Install mysql: yum install mysql-server
Change Password:
Grant all on *. * to 'root' @ 'localhost' identified by 'your password' with grant option; flush privileges
Configure Nginx: Enter/etc/nginx to create a new file: proxy. conf:
proxy_redirect off;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;client_max_body_size 10m;client_body_buffer_size 128k;proxy_connect_timeout 90;proxy_send_timeout 90;proxy_read_timeout 90;proxy_buffer_size 4k;proxy_buffers 4 32k;proxy_busy_buffers_size 64k;proxy_temp_file_write_size 64k;
Go to/etc/nginx/conf. d to create tomcat. conf.
server { listen 8080; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / { #root /usr/share/nginx/html; index index.html index.htm;proxy_pass http://127.0.0.1:8090/; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #}}
Nginx configuration complete
Configure default. conf (or create a new one ):
server { listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; location / { #root /usr/share/nginx/html; root /var/www/html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #}}
Restart:/usr/sbin/nginx-t-c/etc/nginx. conf
Note:
Example of chkconfig:
Chkconfig -- list # list all system services
Chkconfig -- add httpd # add httpd service
Chkconfig -- del httpd # Delete the httpd service
Chkconfig -- level httpd 2345 on # Sets httpd to on when the running level is 2, 3, 4, or 5.
Chkconfig -- list # list all system startup statuses
Chkconfig -- list mysqld # list mysqld service settings
Chkconfig -- level 35 mysqld on # Set mysqld to run at level 3 and 5. -- level 35 indicates that the operation is only executed at level 3 and 5, on indicates that the operation is started, and off indicates that the operation is disabled.
Chkconfig mysqld on # Set mysqld to on at each level. "Each level" includes 2, 3, 4, and 5 levels.
How to add a service:
1. The service script must be stored in the/etc/ini. d/directory;
2. chkconfig -- add servicename
Add this service to the chkconfig tool service list. In this case, the service will be assigned a K/S entry in/etc/rc. d/rcN. d;
3. chkconfig -- level 35 mysqld on
Modify the default service start level.
Is there a simple way to configure nginx + mysql + PHP in centos?
Yum is the easiest to install
Www. centos. bz/...-lnmp/
How to install and configure the DHCP server in CentOS 62
The system comes with yum if it is not installed.
Yum install dhcp
After security, create a configuration file
Cp/usr/share/doc/dhcp */dhcpd. conf. sample/etc/dhcpd. conf
Where option routers is the gateway address you want to configure (usually dhcp is the local ip address); option subnet-mask subnet mask;
You can use other items by default. After saving the configuration file, you can start the service.
/Etc/init. d/dhcpd start