系統環境
centos 6.5
依賴環境
nginx
安裝ngnix
yum install nginx #安裝nginx,根據提示,輸入Y安裝即可成功安裝
service nginx start #啟動
chkconfig nginx on #設為開機啟動
/etc/init.d/nginx restart #重啟
nginx默認站點目錄
/usr/share/nginx/html/
mysql
安裝mysql
yum install mysql mysql-server #詢問是否要安裝,輸入Y即可自動安裝,直到安裝完成
/etc/init.d/mysqld start #啟動MySQL
chkconfig mysqld on #設為開機啟動
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf #拷貝配置文件(注意:如果/etc目錄下面默認有一個my.cnf,直接覆蓋即可)
shutdown -r now #重啟系統
設置密碼
mysql_secure_installation
回車,根據提示輸入Y
romote 那一步輸入n,可以遠程訪問
重啟mysql
/etc/init.d/mysqld stop #停止
/etc/init.d/mysqld start #啟動
service mysqld restart #重啟
php
安裝php
yum install php
安裝PHP組件,使PHP支持 MySQL、PHP支持FastCGI模式
yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm
重啟服務
/etc/init.d/mysqld restart #重啟MySql
/etc/init.d/nginx restart #重啟nginx
/etc/rc.d/init.d/php-fpm start #啟動php-fpm
chkconfig php-fpm on #設置開機啟動
phpmyadmin
安裝
yum install phpmyadmin
安裝后phpmyadmin目錄在/usr/share/phpmyadmin/
配置
vim /etc/nginx/conf.d/phpmyadmin.conf
server {
listen 80;
server_name phpmyadmin.example.com;
access_log /var/log/nginx/phpmyadmin-access.log main;
location / {
root /usr/share/phpmyadmin;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /usr/share/phpmyadmin;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
設置短密碼
問題:
web訪問phpmyadmin時,報錯:配置文件現在需要絕密的短語密碼(blowfish_secret)
解決方法:
vim /usr/share/phpmyadmin/config.inc.php
$cfg['blowfish_secret'] = 'x'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
訪問地址
osTicket
下載
安裝
安裝插件
存放目錄
/data/projects/osTicket/upload/include/plugins
安裝語言包
存放目錄
/data/projects/osTicket/upload/include/i18n
``
配置
nginx
vim /etc/nginx/conf.d/osticket.conf
server {
listen 80;
server_name ticket.example.com;
root /data/projects/osTicket/upload;
access_log /var/log/nginx/ticket-console-access.log main;
set $path_info "";
# Deny access to all files in the include directory
location ~ ^/include {
deny all;
return 403;
}
# Deny access to apache .ht* files (nginx doesn't use these)
location ~ /\.ht {
deny all;
}
# Requests to /api/* need their PATH_INFO set, this does that
if ($request_uri ~ "^/api(/[^\?]+)") {
set $path_info $1;
}
# /api/*.* should be handled by /api/http.php if the requested file does not exist
location ~ ^/api/(tickets|tasks)(.*)$ {
try_files $uri $uri/ /api/http.php;
}
# /scp/ajax.php needs PATH_INFO too, possibly more files need it hence the .*\.php
if ($request_uri ~ "^/scp/.*\.php(/[^\?]+)") {
set $path_info $1;
}
# Make sure requests to /scp/ajax.php/some/path get handled by ajax.php
location ~ ^/scp/ajax.php/(.*)$ {
try_files $uri $uri/ /scp/ajax.php;
}
# Set index.php as our directoryindex
location / {
index index.php;
}
# Send php files off to the PHP-FPM listing on localhost:9000
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
include fastcgi_params;
}
}
重啟服務
service nginx restart
站點訪問
參考
CentOS 6.5 yum安裝配置lnmp服務器(Nginx+PHP+MySQL)
配置文件現在需要絕密的短語密碼(blowfish_secret)的解決方法
Minor issue - Apache error logs : client denied by server config /var/www/config/scp
Error when accessing some internal ajax uri
Doesn't work on NGINX due to use of .htaccess files and relying on PATH_INFO
資源
osTicket 系統、插件及中文語言包
https://yunpan.cn/cMmeNr2FjTPLC (提取碼:5cd5)