Summary of using Alibaba Cloud Server 1----Modify configuration, Alibaba-_PHP tutorial

WBOY
Release: 2016-07-13 09:53:24
Original
1287 people have browsed it

Summary of using Alibaba Cloud Server 1----Modify the configuration, Alibaba----

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:

Summary of using Alibaba Cloud Server 1----Modify configuration, Alibaba-_PHP tutorialserver { 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

After 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
Copy after login

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>
Copy after login
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~~

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1001466.htmlTechArticleSummary of using Alibaba Cloud Server 1----Modify the configuration, Alibaba----Alibaba Cloud Server can be In the mirror market, choose a system with a well-configured environment. Just select the appropriate system and related configurations...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template