日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

CentOS在安装配置 Ngnix_tomcat_PHP_Mysql

發布時間:2025/4/14 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CentOS在安装配置 Ngnix_tomcat_PHP_Mysql 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

安裝Nginx

yum install nginx
假設顯示找不到 nginx包,新建一個文件/etc/yum.repos.d/nginx.repo,內容: [nginx] name=nginx repo baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/ gpgcheck=0 enabled=1
當中:OS替換成centos或者rhel,依據你安裝的發行版版本號?OSRELEASE替換成5,6或者7,分別相應著5.想,6.x,7.x 如: [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/6/$basearch/ gpgcheck=0 enabled=1 ~刪除之前的httpd yum remove httpd
安裝 yum install ngnix
推斷conf /usr/sbin/nginx -t
啟動: service nginx restart
增加自啟動 chkconfig --levels 235 nginx on

安裝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

在文件末尾加入cgi.fix_pathinfo = 1

啟動php-fpm:
service php-fpm startphp-fpm增加啟動項:
chkconfig --levels 235 php-fpm on

安裝Tomcat

下載解壓到/usr/local/tomcat port改為8090 啟動就可以

安裝mysql:

yum install mysql mysql-server 設置password: mysql>use mysql; mysql>update user set password=password('你的密碼') where user='root'; mysql>flush privileges;
改動password:grant all on *.* to 'root'@'localhost' IDENTIFIED BY '你的password'with grant option ; flush privileges

配置Nginx:

進入/etc/nginx 新建一個文件: 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;
進入:/etc/nginx/conf.d 新建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配置完畢
配置default.conf(也能夠新建一個): 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 ?$document_root$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;#} }

重新啟動就可以 也能夠平滑重新啟動:/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
注:

chkconfig?使用范例:
chkconfig --list??????? #列出全部的系統服務
chkconfig --add httpd??????? #添加httpd服務
chkconfig --del httpd??????? #刪除httpd服務
chkconfig --level httpd 2345 on??????? #設置httpd在執行級別為2、3、4、5的情況下都是on(開啟)的狀態
chkconfig --list??????? #列出系統全部的服務啟動情況
chkconfig --list mysqld??????? #列出mysqld服務設置情況
chkconfig --level 35 mysqld on??????? #設定mysqld在等級3和5為開機執行服務,--level 35表示操作僅僅在等級3和5執行。on表示啟動,off表示關閉
chkconfig mysqld on??????? #設定mysqld在各等級為on,“各等級”包含2、3、4、5等級

怎樣添加一個服務:
1.服務腳本必須存放在/etc/ini.d/文件夾下。
2.chkconfig --add servicename
??? 在chkconfig工具服務列表中添加此服務,此時服務會被在/etc/rc.d/rcN.d中賦予K/S入口了;
3.chkconfig --level 35 mysqld on
??? 改動服務的默認啟動等級。



版權聲明:本文博客原創文章,博客,未經同意,不得轉載。

轉載于:https://www.cnblogs.com/blfshiye/p/4622882.html

總結

以上是生活随笔為你收集整理的CentOS在安装配置 Ngnix_tomcat_PHP_Mysql的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。