Ubuntu下Nginx多站点配置
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.重启服务器.
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });sudo service nginx restart
以上就介绍了Ubuntu下Nginx多站点配置,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
推荐阅读
-
Ubuntu下Anaconda和Pycharm配置方法详解
-
Ubuntu Server 16.04下mysql8.0安装配置图文教程
-
win2003下nginx 0.8.38 安装配置备忘
-
win2003下nginx 0.8.38 安装配置备忘
-
Centos7下nginx的安装与配置
-
linux Ubuntu下SSH无密码验证配置的方法步骤
-
Ubuntu系统下的Nginx服务器软件安装时的常见错误解决
-
Ubuntu14.04服务器环境下配置PHP7.0+Apache2+Mysql5.7的方法
-
详解Linux环境下使Nginx服务器支持中文url的配置流程
-
ubuntu下安装Python多版本的方法及注意事项