国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

使用阿里云服務器的總結一----修改配置

2019-11-15 02:13:47
字體:
來源:轉載
供稿:網友
使用阿里云服務器的總結一----修改配置

阿里云服務器可以到鏡像市場選擇配置好環境的系統,選擇合適系統和相關配置即可,linux系統相對更新安全一些,所以就選擇了linux系統的,下面就總結一下遇到的問題和解決方法

我選的linux系統+MySQL-5.5.37+nginx-1.4.7+php-5.4.27 項目用的ThinkPHP3.1.3

剛上傳上去,遇到的問題

1、nginx是不支持pathinfo的

ThinkPHP支持通過PATHINFO和URL rewrite的方式來提供友好的URL,只需要在配置文件中設置 'URL_MODEL' => 2 即可。在Apache下只需要開啟mod_rewrite模塊就可以正常訪問了,但是Nginx中默認是不支持PATHINFO的,

所以我們需要修改/alidata/server/nginx-1.4.7/conf/vhosts修改這個文件,重寫路由

代碼如下:

server {    listen       80 default;    server_name  _;    index index.html index.htm index.php;    root /alidata/www/default;    #include /alidata/www/default/.htaccess;    location /    {        index index.php;          if (!-e $request_filename) {           rewrite ^/(.*)$ /index.php/$1 last;          break;          }    }    location ~ .+/.php($|/) {          set $script $uri;          set $path_info "/";          if ($uri ~ "^(.+/.php)(/.+)") {          set $script $1;          set $path_info $2;          }                    fastcgi_pass 127.0.0.1:9000;          fastcgi_index index.php?IF_REWRITE=1;          include /alidata/server/nginx-1.4.7/conf/fastcgi_params;          fastcgi_param PATH_INFO $path_info;          fastcgi_param SCRIPT_FILENAME $document_root/$script;          fastcgi_param SCRIPT_NAME $script;     }    location ~ .*/.(gif|jpg|jpeg|png|bmp|swf)$    {        expires 30d;    }    location ~ .*/.(js|CSS)?$    {        expires 1h;    }    access_log  /alidata/log/nginx/access/default.log;}
default.conf

修改完配置,就需要重啟Nginx,可以通過重啟實例(即系統)或者通過命令

重啟實例略

操作命令如下

nginx -s reload  修改配置后重新加載生效關閉nginx:nginx -s stop  快速停止nginx

阿里云服務器在這里重啟會有問題(即:"/alidata/server/nginx/logs/nginx.pid" failed)

(參考地址為:http://www.dedecms8.com/os/linux/49999.html)

解決辦法就是直接在ssh或者其他終端里執行:

/alidata/server//nginx/sbin/nginx -c /alidata/server//nginx/conf/nginx.conf
然后切換到logs目錄下,執行ll看到nginx.pid進程,即說明正常啟動:[root@localhost nginx]# cd logs/[root@localhost logs]# ll總用量 12-rw-r--r-- 1 root root 1246 12月 9 18:10 access.log-rw-r--r-- 1 root root 516 12月 10 15:39 error.log-rw-r--r-- 1 root root 5 12月 10 15:38 nginx.pid

這樣就OK了~~


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 前郭尔| 黄山市| 竹北市| 上林县| 大洼县| 旬阳县| 志丹县| 黑山县| 都江堰市| 平乡县| 师宗县| 正镶白旗| 北宁市| 凤台县| 贺兰县| 黎城县| 吉木萨尔县| 左权县| 榕江县| 绥棱县| 天津市| 鄂温| 大冶市| 宁蒗| 黔江区| 叶城县| 崇明县| 胶南市| 惠州市| 米脂县| 望城县| 清水县| 鲜城| 盈江县| 双桥区| 嘉善县| 图片| 凌源市| 聂拉木县| 肇庆市| 竹北市|