Home >Backend Development >PHP Tutorial >Summary of using Alibaba Cloud Server 1----Modify configuration, Alibaba-_PHP tutorial
Alibaba Cloud Server can go to the mirror market to choose a system with a well-configured environment, and choose the appropriate one The system and related configurations are enough. The Linux system is relatively newer and safer, so I chose the Linux system. Here is a summary of the problems encountered and solutions
The linux system I chose is mysql-5.5.37 nginx-1.4.7 php-5.4.27 The project uses ThinkPHP3.1.3
I just uploaded it and encountered some problems
1. nginx does not support pathinfo
ThinkPHP supports providing friendly URLs through PATHINFO and URL rewrite. You only need to set 'URL_MODEL' => 2 in the configuration file. Under Apache, you only need to enable the mod_rewrite module for normal access, but Nginx does not support PATHINFO by default,
So we need to modify /alidata/server/nginx-1.4.7/conf/vhosts to modify this file and rewrite the routing
The code is as follows:
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.confAfter modifying the configuration, you need to restart Nginx. You can restart the instance (i.e. system) or pass the command
Restart the instance briefly
The operation commands are as follows
nginx -<span>s reload 修改配置后重新加载生效 关闭nginx: nginx </span>-s stop 快速停止nginx
There will be problems restarting the Alibaba Cloud server here (i.e.: "/alidata/server/nginx/logs/nginx.pid" failed)
(Reference address: http://www.dedecms8.com/os/linux/49999.html)
The solution is to execute it directly in ssh or other terminal:
/alidata/server<span>//</span><span>nginx/sbin/nginx -c /alidata/server//nginx/conf/nginx.conf</span>Then switch to the logs directory and execute ll to see the nginx.pid process, which means it starts normally: [root@localhost nginx]# cd logs/ [root@localhost logs]#ll Total usage 12 -rw-r--r-- 1 root root 1246 December 9 18:10 access.log -rw-r--r-- 1 root root 516 December 10 15:39 error.log -rw-r--r-- 1 root root 5 December 10 15:38 nginx.pid
That’s OK~~