1.利用命令行打开/etc/nginx/sites-available/default文件
sudo vi /etc/nginx/sites-available/default
2.将server代码复制,修改listen端口,文件路径和server_name
server {
listen 8011; #配置端口号
listen [::]:8011; #配置端口号
# ssl configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# note: you should disable gzip for ssl traffic.
# see: https://bugs.debian.org/773332
#
# read up on ssl_ciphers to ensure a secure configuration.
# see: https://bugs.debian.org/765782
#
# self signed certs generated by the ssl-cert package
# don’t use them in a production server!
#
# include snippets/snakeoil.conf;
root /xxx/xxx/xxx; #配置文件路径
# add index.php to the list if you are using php
index index.html index.htm index.php;
server_name xxx.xxx; #配置服务器名location / { # first attempt to serve request as file, then # as directory, then fall back to displaying a 404. #try_files $uri $uri/ =404; try_files $uri $uri/ /index.php?$args; }# pass the php scripts to fastcgi server listening on 127.0.0.1:9000#location ~ \.php$ { include snippets/fastcgi-php.conf;## # with php5-cgi alone:# fastcgi_pass 127.0.0.1:9000;# # with php5-fpm: fastcgi_pass unix:/var/run/php5-fpm.sock;}# deny access to .htaccess files, if apache's document root# concurs with nginx's one##location ~ /\.ht {# deny all;#}
}
3.重启服务器.
sudo service nginx restart
').addclass('pre-numbering').hide(); $(this).addclass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadein(1700); }); }); 以上就介绍了ubuntu下nginx多站点配置,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。